{"action":"created","issue":{"url":"https://api.github.com/repos/cqcallaw/newt/issues/6","labels_url":"https://api.github.com/repos/cqcallaw/newt/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/cqcallaw/newt/issues/6/comments","events_url":"https://api.github.com/repos/cqcallaw/newt/issues/6/events","html_url":"https://github.com/cqcallaw/newt/issues/6","id":124576740,"number":6,"title":"Function overloading","user":{"login":"cqcallaw","id":312296,"avatar_url":"https://avatars.githubusercontent.com/u/312296?v=3","gravatar_id":"","url":"https://api.github.com/users/cqcallaw","html_url":"https://github.com/cqcallaw","followers_url":"https://api.github.com/users/cqcallaw/followers","following_url":"https://api.github.com/users/cqcallaw/following{/other_user}","gists_url":"https://api.github.com/users/cqcallaw/gists{/gist_id}","starred_url":"https://api.github.com/users/cqcallaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cqcallaw/subscriptions","organizations_url":"https://api.github.com/users/cqcallaw/orgs","repos_url":"https://api.github.com/users/cqcallaw/repos","events_url":"https://api.github.com/users/cqcallaw/events{/privacy}","received_events_url":"https://api.github.com/users/cqcallaw/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cqcallaw/newt/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-02T05:43:04Z","updated_at":"2016-01-13T04:31:56Z","closed_at":null,"body":"Note: we must be sure the side-by-side declarations `f:= (a:int) -> int` and `f:= (a:int=2) -> int` are handled correctly (they have the same signature, but one has a default value)"},"comment":{"url":"https://api.github.com/repos/cqcallaw/newt/issues/comments/171163020","html_url":"https://github.com/cqcallaw/newt/issues/6#issuecomment-171163020","issue_url":"https://api.github.com/repos/cqcallaw/newt/issues/6","id":171163020,"user":{"login":"cqcallaw","id":312296,"avatar_url":"https://avatars.githubusercontent.com/u/312296?v=3","gravatar_id":"","url":"https://api.github.com/users/cqcallaw","html_url":"https://github.com/cqcallaw","followers_url":"https://api.github.com/users/cqcallaw/followers","following_url":"https://api.github.com/users/cqcallaw/following{/other_user}","gists_url":"https://api.github.com/users/cqcallaw/gists{/gist_id}","starred_url":"https://api.github.com/users/cqcallaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cqcallaw/subscriptions","organizations_url":"https://api.github.com/users/cqcallaw/orgs","repos_url":"https://api.github.com/users/cqcallaw/repos","events_url":"https://api.github.com/users/cqcallaw/events{/privacy}","received_events_url":"https://api.github.com/users/cqcallaw/received_events","type":"User","site_admin":false},"created_at":"2016-01-13T04:31:56Z","updated_at":"2016-01-13T04:31:56Z","body":"After an extended discussion with @laokaplow, the proposed syntax for this feature has changed. Given\r\n```\r\nf:= (a:int) -> int { ... }\r\nf:= (a:double) -> int { ... }\r\n```\r\nallowing the second declaration to overload the first declaration implicitly changes the type of `f` from `(int)->int` to a _sum type_ of `(int)->int AND (double)->int` (an option type--that is, \"or\"--is not used because `f` contains values for _both_ types, not just one or the other).\r\n\r\nThis implicit type re-interpretation can be avoided by requiring all function overloads to be specified as part of a single declaration statement, like so:\r\n```\r\nf:= (a:int) -> int { ... } & (a:double) -> int { ... }\r\n```\r\nThe ampersand indicates AND, shorted to the ampersand by common convention.\r\n\r\nThis ampersand syntax is the new proposed syntax for function overloading."}}