{"action":"created","issue":{"url":"https://api.github.com/repos/keean/zenscript/issues/11","repository_url":"https://api.github.com/repos/keean/zenscript","labels_url":"https://api.github.com/repos/keean/zenscript/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/keean/zenscript/issues/11/comments","events_url":"https://api.github.com/repos/keean/zenscript/issues/11/events","html_url":"https://github.com/keean/zenscript/issues/11","id":178798168,"number":11,"title":"Syntax summary","user":{"login":"shelby3","id":247731,"avatar_url":"https://avatars.githubusercontent.com/u/247731?v=3","gravatar_id":"","url":"https://api.github.com/users/shelby3","html_url":"https://github.com/shelby3","followers_url":"https://api.github.com/users/shelby3/followers","following_url":"https://api.github.com/users/shelby3/following{/other_user}","gists_url":"https://api.github.com/users/shelby3/gists{/gist_id}","starred_url":"https://api.github.com/users/shelby3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shelby3/subscriptions","organizations_url":"https://api.github.com/users/shelby3/orgs","repos_url":"https://api.github.com/users/shelby3/repos","events_url":"https://api.github.com/users/shelby3/events{/privacy}","received_events_url":"https://api.github.com/users/shelby3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":253,"created_at":"2016-09-23T06:47:56Z","updated_at":"2016-09-30T10:01:04Z","closed_at":null,"body":"I will maintain in this OP a summary of current proposed syntax as I understand it to be. Note this is not authoritative, subject to change, and it may be inaccurate. Please make comments to discuss.\r\n\r\n`: Type` is always optional.\r\n\r\n1. [Sum, Recursive](http://stackoverflow.com/questions/5911267/what-are-sums-and-products-data-structures), [Record](https://github.com/keean/zenscript/issues/1#issuecomment-249349283), and [Product](https://github.com/keean/zenscript/issues/1#issuecomment-249348936) parametrized data type with optional Record member names and optional Record (e.g. `Cons`) and Product (e.g. `MetaData`) names:\r\n\r\n   `data List<T> = MetaData(Nil | Cons{head: T, tail: List<T>}, {meta: Meta<T>})`\r\n\r\n2. Typeclass interface and implementation:\r\n\r\n   ```\r\n   typeclass Name<A<B>, ...>   // or 'pluggable'?; optional <B> for higher-kinds¹?\r\n      method(B): A<B>           // TODO: add default arguments, named arguments?\r\n\r\n   List<A> implements Name\r\n      method(x) => ...\r\n   ```\r\n\r\n3. References:\r\n\r\n   ```\r\n   let x:Type = ...      // final assignment, not re-assignable (same as const in ES5/6)\r\n   var x:Type = ...      // (same as let in ES5/6)\r\n   ```\r\n\r\n4. Functions:\r\n\r\n   Type parameters [do not require declaration](https://github.com/keean/zenscript/issues/6#issuecomment-248742773) `<A,B>`.\r\n\r\n   ```\r\n   someCallback(x:Type y:Type(:Type) => x + y)     //            also  ():Type => x + y\r\n   var f = x:Type y:Type(:Type) => x + y           // not named, also  ():Type => x + y\r\n   f = x:Type y:Type(:Type) => x + y               // not named, also  ():Type => x + y\r\n   let f(x:Type, y:Type):Type => x + y             // named f,   also f():Type => x + y\r\n   let parametrized(x: A, y: B):A|B => x || y\r\n   let parametrizedWhere(x: A, y: B):A|B where ... => x || y\r\n   ```\r\n\r\n   Note that iterator types can be specified for the return value to return a lazy list as a generalized way of implementing generators. The optional `(:Type)` is necessited for [generator functions](https://github.com/keean/zenscript/issues/17). Note the `(x: Type y: Type): Type => x + y` form [is unavailable](https://github.com/keean/zenscript/issues/11#issuecomment-249770741).\r\n\r\n5. [Assignment-as-expression](https://github.com/keean/zenscript/issues/6#issuecomment-248744745):\r\n\r\n   ```\r\n   if ((x = 0))      // force extra parenthesis where expected type is Boolean\r\n   ```\r\n\r\n† Not yet included in the syntax, as would be a premature optimization. May or may not be added.\r\n¹ https://github.com/keean/zenscript/issues/10"},"comment":{"url":"https://api.github.com/repos/keean/zenscript/issues/comments/250707267","html_url":"https://github.com/keean/zenscript/issues/11#issuecomment-250707267","issue_url":"https://api.github.com/repos/keean/zenscript/issues/11","id":250707267,"user":{"login":"shelby3","id":247731,"avatar_url":"https://avatars.githubusercontent.com/u/247731?v=3","gravatar_id":"","url":"https://api.github.com/users/shelby3","html_url":"https://github.com/shelby3","followers_url":"https://api.github.com/users/shelby3/followers","following_url":"https://api.github.com/users/shelby3/following{/other_user}","gists_url":"https://api.github.com/users/shelby3/gists{/gist_id}","starred_url":"https://api.github.com/users/shelby3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shelby3/subscriptions","organizations_url":"https://api.github.com/users/shelby3/orgs","repos_url":"https://api.github.com/users/shelby3/repos","events_url":"https://api.github.com/users/shelby3/events{/privacy}","received_events_url":"https://api.github.com/users/shelby3/received_events","type":"User","site_admin":false},"created_at":"2016-09-30T10:01:04Z","updated_at":"2016-09-30T10:01:04Z","body":"@keean wrote:\r\n>> Oic. You are thinking that any non-unit type expression is a return if it is not assigned. Yikes. I wasn't proposing that. That is strange. Would cause many unintended errors.\r\n>\r\n> Isn't this obvious, the compiler would report an error if there are any unreachable statements afterwards, but otherwise what happens to the value?\r\n\r\nIt wouldn't report an error if that was a single expression of an `if`.\r\n\r\nNothing happens to the value, as is the case in imperative programs."}}
{"actor":{"display_login":"shelby3"}}