{"action":"created","issue":{"url":"https://api.github.com/repos/egonSchiele/contracts.ruby/issues/157","labels_url":"https://api.github.com/repos/egonSchiele/contracts.ruby/issues/157/labels{/name}","comments_url":"https://api.github.com/repos/egonSchiele/contracts.ruby/issues/157/comments","events_url":"https://api.github.com/repos/egonSchiele/contracts.ruby/issues/157/events","html_url":"https://github.com/egonSchiele/contracts.ruby/issues/157","id":83426787,"number":157,"title":"Do not require importing contract class names into client classes","user":{"login":"robnormal","id":673577,"avatar_url":"https://avatars.githubusercontent.com/u/673577?v=3","gravatar_id":"","url":"https://api.github.com/users/robnormal","html_url":"https://github.com/robnormal","followers_url":"https://api.github.com/users/robnormal/followers","following_url":"https://api.github.com/users/robnormal/following{/other_user}","gists_url":"https://api.github.com/users/robnormal/gists{/gist_id}","starred_url":"https://api.github.com/users/robnormal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robnormal/subscriptions","organizations_url":"https://api.github.com/users/robnormal/orgs","repos_url":"https://api.github.com/users/robnormal/repos","events_url":"https://api.github.com/users/robnormal/events{/privacy}","received_events_url":"https://api.github.com/users/robnormal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":56,"created_at":"2015-06-01T10:32:57Z","updated_at":"2015-06-12T12:05:59Z","closed_at":null,"body":"On a large project, there may be a large number of contracts you will want to name, and these names will then be included in every class that includes the `Contracts` module. The potential for naming collisions could grow very quickly. (I am already having this problem - I have a class called \"Maybe\".)\r\n\r\nOne possible fix would be an alternative include, in which the `Contract` method takes a block instead of a hash.\r\n```ruby\r\nclass Alpha\r\n  include ContractsSafe\r\n  Contract { ArrayOf[Num] => Maybe[Or[This, That]] }\r\n  # ...\r\nend\r\n```\r\nThe block could then be `instance_eval`-ed elsewhere, isolating the contract names."},"comment":{"url":"https://api.github.com/repos/egonSchiele/contracts.ruby/issues/comments/111469744","html_url":"https://github.com/egonSchiele/contracts.ruby/issues/157#issuecomment-111469744","issue_url":"https://api.github.com/repos/egonSchiele/contracts.ruby/issues/157","id":111469744,"user":{"login":"robnormal","id":673577,"avatar_url":"https://avatars.githubusercontent.com/u/673577?v=3","gravatar_id":"","url":"https://api.github.com/users/robnormal","html_url":"https://github.com/robnormal","followers_url":"https://api.github.com/users/robnormal/followers","following_url":"https://api.github.com/users/robnormal/following{/other_user}","gists_url":"https://api.github.com/users/robnormal/gists{/gist_id}","starred_url":"https://api.github.com/users/robnormal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robnormal/subscriptions","organizations_url":"https://api.github.com/users/robnormal/orgs","repos_url":"https://api.github.com/users/robnormal/repos","events_url":"https://api.github.com/users/robnormal/events{/privacy}","received_events_url":"https://api.github.com/users/robnormal/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T12:05:59Z","updated_at":"2015-06-12T12:05:59Z","body":"@waterlink I find the third syntax to be the most readable by far, as well as the most transparent to a Ruby programmer. @sfcgeorge Not sure where you see a conflict. Just as users could not define a \"Maybe\" contract without overwriting the existing one, they could not define a \"maybe\" method without overwriting the existing one. This is standard, no?\r\n\r\nIncidentally, I'd like to point out that `eval` is not \"evil\"; calling `eval` on end-user input is a security hole, that is all. If you're putting end-user input in your contract definitions, you are most definitely doing it wrong."}}