{"action":"created","issue":{"url":"https://api.github.com/repos/dry-rb/dry-constructor/issues/1","repository_url":"https://api.github.com/repos/dry-rb/dry-constructor","labels_url":"https://api.github.com/repos/dry-rb/dry-constructor/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/dry-rb/dry-constructor/issues/1/comments","events_url":"https://api.github.com/repos/dry-rb/dry-constructor/issues/1/events","html_url":"https://github.com/dry-rb/dry-constructor/issues/1","id":131036308,"number":1,"title":"Propose of changing/extending the API","user":{"login":"marshall-lee","id":3194530,"avatar_url":"https://avatars.githubusercontent.com/u/3194530?v=3","gravatar_id":"","url":"https://api.github.com/users/marshall-lee","html_url":"https://github.com/marshall-lee","followers_url":"https://api.github.com/users/marshall-lee/followers","following_url":"https://api.github.com/users/marshall-lee/following{/other_user}","gists_url":"https://api.github.com/users/marshall-lee/gists{/gist_id}","starred_url":"https://api.github.com/users/marshall-lee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marshall-lee/subscriptions","organizations_url":"https://api.github.com/users/marshall-lee/orgs","repos_url":"https://api.github.com/users/marshall-lee/repos","events_url":"https://api.github.com/users/marshall-lee/events{/privacy}","received_events_url":"https://api.github.com/users/marshall-lee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-02-03T14:07:16Z","updated_at":"2016-03-21T22:10:52Z","closed_at":null,"body":"Hello!\r\n\r\nI was already experimenting with my new gem https://github.com/marshall-lee/function_object when I realized there's `dry-constructor`. My function_object comes from another perspective: you basically want not only inject dependencies but also make a `call`. Someone would call my function object just a service object, someone would call it a lambda with the ability to use letrec (to use instance methods, I mean).\r\n\r\nThere's no README written yet, everything is in this little spec: https://github.com/marshall-lee/function_object/blob/master/spec/function_object_spec.rb\r\n\r\nI think it'd be cool to delegate a construction step of `FunctionObject` to `Dry::Constructor`. However, current API does not allow to associate something with each argument. For example, `FunctionObject` allows to define a `default: -> { ... }` option for arguments. I also plan to implement a mixin that adds  `type: ` annotations to use the power of `dry-data` types. All of these things require another approach to describe arguments which are currently described just as a list of names.\r\n\r\nI propose to bring the `FunctionObject`'s approach of describing a constructor:\r\n\r\n```ruby\r\nclass CreateUserController\r\n  include Dry::Constructor.define {\r\n    arg :response\r\n    arg :validator\r\n    arg :command\r\n  }\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/dry-rb/dry-constructor/issues/comments/199511160","html_url":"https://github.com/dry-rb/dry-constructor/issues/1#issuecomment-199511160","issue_url":"https://api.github.com/repos/dry-rb/dry-constructor/issues/1","id":199511160,"user":{"login":"AMHOL","id":1582784,"avatar_url":"https://avatars.githubusercontent.com/u/1582784?v=3","gravatar_id":"","url":"https://api.github.com/users/AMHOL","html_url":"https://github.com/AMHOL","followers_url":"https://api.github.com/users/AMHOL/followers","following_url":"https://api.github.com/users/AMHOL/following{/other_user}","gists_url":"https://api.github.com/users/AMHOL/gists{/gist_id}","starred_url":"https://api.github.com/users/AMHOL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AMHOL/subscriptions","organizations_url":"https://api.github.com/users/AMHOL/orgs","repos_url":"https://api.github.com/users/AMHOL/repos","events_url":"https://api.github.com/users/AMHOL/events{/privacy}","received_events_url":"https://api.github.com/users/AMHOL/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T22:10:52Z","updated_at":"2016-03-21T22:10:52Z","body":"FWIW I'm not keen on pushing the responsibility of coercion back to the object that the properties are on, it feels like moving back towards virtus. I've added the behaviour that I think dry-constructor should handle in [this PR](https://github.com/dry-rb/dry-constructor/pull/5) please check it out if you get a chance"}}