{"action":"created","issue":{"url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/406","labels_url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/406/labels{/name}","comments_url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/406/comments","events_url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/406/events","html_url":"https://github.com/CausalityLtd/ponyc/issues/406","id":118924879,"number":406,"title":"Keywords for guards are inconsistent","user":{"login":"andymcn","id":7050628,"avatar_url":"https://avatars.githubusercontent.com/u/7050628?v=3","gravatar_id":"","url":"https://api.github.com/users/andymcn","html_url":"https://github.com/andymcn","followers_url":"https://api.github.com/users/andymcn/followers","following_url":"https://api.github.com/users/andymcn/following{/other_user}","gists_url":"https://api.github.com/users/andymcn/gists{/gist_id}","starred_url":"https://api.github.com/users/andymcn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andymcn/subscriptions","organizations_url":"https://api.github.com/users/andymcn/orgs","repos_url":"https://api.github.com/users/andymcn/repos","events_url":"https://api.github.com/users/andymcn/events{/privacy}","received_events_url":"https://api.github.com/users/andymcn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-25T21:12:48Z","updated_at":"2015-11-25T21:20:31Z","closed_at":null,"body":"We're currently being inconsistent, and arguably ambiguous, with the keywords used for guard conditions, ie `where` and `if`.\r\n\r\nWe use guards to indicate that a piece of code is only relevant under certain conditions. We do this in 3 places (that I can think of):\r\n\r\n1. Cases of a match expression.\r\n1. Case methods.\r\n1. use commands for declaring FFIs, linking libraries, etc.\r\n\r\nFor the first 2 of these we use `where`, but for the last we use `if`.\r\n\r\nFurthermore we also use `where` to indicate arguments passed by name, which is an unrelated concept.\r\n\r\nI think we should use the same keyword for all 3 of these guards (and any others we add later), and it probably shouldn't be the same as the keyword for passing arguments by name.\r\n\r\nAn obvious choice is to keep `where` for arguments by name and use `if` for all guards, however that would make the syntax for match cases ambiguous, since `if` could be part of the pattern.\r\n\r\nAn alternative would be to use `where` for both guards and arguments by name, although that seems a bit ugly.\r\n\r\nOther suggestions welcome."},"comment":{"url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/comments/159733887","html_url":"https://github.com/CausalityLtd/ponyc/issues/406#issuecomment-159733887","issue_url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/406","id":159733887,"user":{"login":"jemc","id":4623870,"avatar_url":"https://avatars.githubusercontent.com/u/4623870?v=3","gravatar_id":"","url":"https://api.github.com/users/jemc","html_url":"https://github.com/jemc","followers_url":"https://api.github.com/users/jemc/followers","following_url":"https://api.github.com/users/jemc/following{/other_user}","gists_url":"https://api.github.com/users/jemc/gists{/gist_id}","starred_url":"https://api.github.com/users/jemc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jemc/subscriptions","organizations_url":"https://api.github.com/users/jemc/orgs","repos_url":"https://api.github.com/users/jemc/repos","events_url":"https://api.github.com/users/jemc/events{/privacy}","received_events_url":"https://api.github.com/users/jemc/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T21:20:31Z","updated_at":"2015-11-25T21:20:31Z","body":"From a quick look at `pony.g`, it looks like we already have `with` as a keyword.  I wasn't aware of it, but it appears to be used in forms like:\r\n```pony\r\nwith foo = \"foo\", bar = \"bar\" do\r\n  foo + bar\r\nend\r\n```\r\n\r\nI'm not quite sure what `with` does, or where it's documented, but it appears to be a related concept to the passing of named arguments.  It's at least more related than a guard expression.\r\n\r\nI'd also say that `with` reads quite naturally when used to pass named arguments, even more naturally than `where`. \r\n\r\n```pony\r\nUtil.concatenate(with foo = \"foo\", bar = \"bar\")\r\n```"}}