{"action":"created","issue":{"url":"https://api.github.com/repos/manastech/crystal/issues/1741","labels_url":"https://api.github.com/repos/manastech/crystal/issues/1741/labels{/name}","comments_url":"https://api.github.com/repos/manastech/crystal/issues/1741/comments","events_url":"https://api.github.com/repos/manastech/crystal/issues/1741/events","html_url":"https://github.com/manastech/crystal/pull/1741","id":111526819,"number":1741,"title":"Make parentheses mandatory for def and macro arguments","user":{"login":"asterite","id":209371,"avatar_url":"https://avatars.githubusercontent.com/u/209371?v=3","gravatar_id":"","url":"https://api.github.com/users/asterite","html_url":"https://github.com/asterite","followers_url":"https://api.github.com/users/asterite/followers","following_url":"https://api.github.com/users/asterite/following{/other_user}","gists_url":"https://api.github.com/users/asterite/gists{/gist_id}","starred_url":"https://api.github.com/users/asterite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterite/subscriptions","organizations_url":"https://api.github.com/users/asterite/orgs","repos_url":"https://api.github.com/users/asterite/repos","events_url":"https://api.github.com/users/asterite/events{/privacy}","received_events_url":"https://api.github.com/users/asterite/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-15T01:29:47Z","updated_at":"2015-10-15T08:14:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/manastech/crystal/pulls/1741","html_url":"https://github.com/manastech/crystal/pull/1741","diff_url":"https://github.com/manastech/crystal/pull/1741.diff","patch_url":"https://github.com/manastech/crystal/pull/1741.patch"},"body":"As the title says, this makes parentheses mandatory for def and macro arguments. That means that this:\r\n\r\n```crystal\r\ndef foo x, y\r\nend\r\n```\r\n\r\nwill give a parse error.\r\n\r\nThere are many reasons for this breaking change, but this one is the main one:\r\n\r\n```crystal\r\ndef foo arg : String\r\nend\r\n```\r\n\r\nIs the above a def with one argument restricted to a String, or a def with one argument without restrictions that returns a String?\r\n\r\nThis ambiguity is solved by using parentheses:\r\n\r\n```crystal\r\ndef foo(arg : String)\r\nend\r\n\r\ndef foo(arg) : String\r\nend\r\n```\r\n\r\nOther reasons:\r\n1. There's always an ongoing discussion between liking/disliking parentheses in method arguments. Mixing these two styles is ugly in a single code base. For example in the standard library and compiler we always use parentheses, but sometimes we have to accept pull requests without parens and it's annoying to just ask to change that.\r\n2. Parentheses aren't annoying and don't hinder readability in defs. In calls it's more understandable because it reads like an action or sentence, \"do this\", \"write that\", but for a method definition it doesn't make much sense.\r\n3. Me, @waj, and many at Manas generally dislike methods written that way :-P\r\n\r\nThe plan is to merge this starting from the next release. The current release will introduce the formatter, which, in addition to reformat code, will also add parentheses to defs and macros. This will allow you to run `crystal tool format` on your project to update it to the latest version of the language. Then we'll merge this.\r\n\r\nThis PR is mainly to let you know about this breaking change (and, of course, hacktober ;-))"},"comment":{"url":"https://api.github.com/repos/manastech/crystal/issues/comments/148314044","html_url":"https://github.com/manastech/crystal/pull/1741#issuecomment-148314044","issue_url":"https://api.github.com/repos/manastech/crystal/issues/1741","id":148314044,"user":{"login":"sdogruyol","id":990485,"avatar_url":"https://avatars.githubusercontent.com/u/990485?v=3","gravatar_id":"","url":"https://api.github.com/users/sdogruyol","html_url":"https://github.com/sdogruyol","followers_url":"https://api.github.com/users/sdogruyol/followers","following_url":"https://api.github.com/users/sdogruyol/following{/other_user}","gists_url":"https://api.github.com/users/sdogruyol/gists{/gist_id}","starred_url":"https://api.github.com/users/sdogruyol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdogruyol/subscriptions","organizations_url":"https://api.github.com/users/sdogruyol/orgs","repos_url":"https://api.github.com/users/sdogruyol/repos","events_url":"https://api.github.com/users/sdogruyol/events{/privacy}","received_events_url":"https://api.github.com/users/sdogruyol/received_events","type":"User","site_admin":false},"created_at":"2015-10-15T08:14:29Z","updated_at":"2015-10-15T08:14:29Z","body":":+1:  for parans in defs"}}