{"action":"created","issue":{"url":"https://api.github.com/repos/coffeescript6/discuss/issues/12","repository_url":"https://api.github.com/repos/coffeescript6/discuss","labels_url":"https://api.github.com/repos/coffeescript6/discuss/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/coffeescript6/discuss/issues/12/comments","events_url":"https://api.github.com/repos/coffeescript6/discuss/issues/12/events","html_url":"https://github.com/coffeescript6/discuss/issues/12","id":167166648,"number":12,"title":"Type Annotations","user":{"login":"rattrayalex","id":704302,"avatar_url":"https://avatars.githubusercontent.com/u/704302?v=3","gravatar_id":"","url":"https://api.github.com/users/rattrayalex","html_url":"https://github.com/rattrayalex","followers_url":"https://api.github.com/users/rattrayalex/followers","following_url":"https://api.github.com/users/rattrayalex/following{/other_user}","gists_url":"https://api.github.com/users/rattrayalex/gists{/gist_id}","starred_url":"https://api.github.com/users/rattrayalex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rattrayalex/subscriptions","organizations_url":"https://api.github.com/users/rattrayalex/orgs","repos_url":"https://api.github.com/users/rattrayalex/repos","events_url":"https://api.github.com/users/rattrayalex/events{/privacy}","received_events_url":"https://api.github.com/users/rattrayalex/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/coffeescript6/discuss/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":19,"created_at":"2016-07-23T04:23:31Z","updated_at":"2016-08-05T04:38:32Z","closed_at":null,"body":"I've assumed it'd be next to impossible to add type annotations to CoffeeScript, but thought we should open an issue to discuss if it might be possible. Static Typing is undergoing a renaissance of sorts these days, with developers flocking to new statically typed languages and adding static annotations to dynamic languages like Python (see PEP484) and JavaScript (via Flow and TypeScript). \r\n\r\n[Flow](http://flowtype.org) supports gradual typing for JavaScript, and has some decent tooling to make development easier. They have [loose](https://github.com/facebook/flow/issues/529) [plans](https://github.com/facebook/flow/issues/248) to ingest an ESTree AST, which could allow integration of Flow and CS6. \r\n\r\nI don't think TypeScript would be a viable target for CS6, as it doesn't play well with Babel (a probable target of CS6) and requires \"complete type coverage\", which wouldn't likely gel well with CoffeeScript developers, who don't like typing (pardon the pun). \r\n\r\nWhile this would be awesome, I struggle to see how it could work, at least with Flow-like syntax and readability:\r\n```\r\nobj: {[id:string]: number} = \r\n  thing: 7\r\nmyFn(a: []number, b: number): []number ->\r\n  a.map(x -> x + b)\r\nmyFnThatTakesACallback(a: number, cb: (id: number) => Promise<number>): Promise<number> => \r\n  cb(a).then(x => x + 1)\r\n```"},"comment":{"url":"https://api.github.com/repos/coffeescript6/discuss/issues/comments/237753338","html_url":"https://github.com/coffeescript6/discuss/issues/12#issuecomment-237753338","issue_url":"https://api.github.com/repos/coffeescript6/discuss/issues/12","id":237753338,"user":{"login":"rattrayalex","id":704302,"avatar_url":"https://avatars.githubusercontent.com/u/704302?v=3","gravatar_id":"","url":"https://api.github.com/users/rattrayalex","html_url":"https://github.com/rattrayalex","followers_url":"https://api.github.com/users/rattrayalex/followers","following_url":"https://api.github.com/users/rattrayalex/following{/other_user}","gists_url":"https://api.github.com/users/rattrayalex/gists{/gist_id}","starred_url":"https://api.github.com/users/rattrayalex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rattrayalex/subscriptions","organizations_url":"https://api.github.com/users/rattrayalex/orgs","repos_url":"https://api.github.com/users/rattrayalex/repos","events_url":"https://api.github.com/users/rattrayalex/events{/privacy}","received_events_url":"https://api.github.com/users/rattrayalex/received_events","type":"User","site_admin":false},"created_at":"2016-08-05T04:38:32Z","updated_at":"2016-08-05T04:38:32Z","body":"Static types are great for a lot of reasons, only one of which is \"check that this kind of bug won't happen\". They also give the editor a lot of useful hints about the program; see the gifs on https://atom.io/packages/atom-typescript for some examples of what's possible. \r\n\r\nDecorator-provided types have been an option for a long time, and yet nobody's opted to build a (widely used) library that provides them, so I'm going to assume that's not an option people find valuable. On the other hand, developers have been flocking to TypeScript and Flow, and dynamic languages like Python are introducing static typing through projects like MyPy and Pep484. \r\n\r\nLet's keep this conversation focused on static types, if that's okay. Runtime types can always be done in an outside library, and provide a different set of benefits. "}}
{"actor":{"display_login":"rattrayalex"}}