-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea: Type Inference #30
Comments
Well this is going to be really complicated. I'd need to do some reading on the subject before I can consider it. |
Better idea: create some sort of optional type specification system which properly compiles to the Google Closure Compiler type annotation comments, so that the compiled js can be run through that and checked if desired. |
That's a good idea. Will the types still be inferred or will the compiler delegate the type annotating responsibilities to the developer? |
The creator of Roy says he is working on a library for Roy that might be able to be adapted to LiveScript. |
That would be so cool |
I've translated python version of damas-hindley-milner type inference algorithm in LiveScript: https://gist.github.com/3130749 (of course it's I've fixed bugs except ones at lines L358 and L372. Would be nice if someone'll find this bugs. |
+1. I would welcome some form of type safety. @goatslacker performance hits could be limited to development via a compile flag (this is what coffee.contracts does). If you make runtime type checking impossible you apparently lose some features (quote):
|
I am interested in type safety / inference also. I'm also very interested in contributing such functionality. What has been done so far? What happened to that Roy library? Is there someone else working on this? @gkz What's your take on all this? Do you have ideas / opinions on how to approach this? I'm interested in contributing but would likely need some form of mentoring because this is all new land to me. I am currently still familiarising myself with the source code as it stands. |
https://github.com/puffnfresh/roy/tree/master/src check out typeinference.js you can probably adapt that to livescript, it's going to be a tough task though since livescript is more lenient in what you can do than roy. |
It'd make more sense to support ES6 optional type annotations and a TypeScript target than implementing from scratch. @puffnfresh is smarter than the average bear (read his blog or check out his contributions) and it's no small task to implement competent structural (duck-typed) type inference. No sense reinventing the wheel. Also I haven't heard talk of LS2 in a while. |
I'm also interested in all things type inference. [ed: removed gmail cruft] |
There is also Scala.js.
ES6 type annotations are a myth? |
There's a Traceur experimental feature that supposedly supports this, but it's non-standard, and I'm pretty sure it just compiles to runtime contracts. |
I think TS wants this kind of stuff to be part of ES7? Not before though... |
Turns out Traceur type annotations are part of AtScript, Google's altjs language they're creating for Angular. They intend to add static verification. |
But... Isn't atscript supposed to be a superset or typescript that's supposed to be a superscript of ES6? I know we're not innocent, but it still makes my head fuzzy. |
|
Currently, there aren't any static typing proposals for ES6 or ES7. |
Another good place to look at is the strawman list on the wiki : |
Is this an Option? http://flowtype.org |
Nope. Facebook can't even get their projects working correctly with each other (think JSX and flow), so no way we can. |
Typescript announced union-types too leaving flow dead in the water. http://blogs.msdn.com/b/typescript/archive/2014/11/18/what-s-new-in-the-typescript-type-system.aspx |
Looks to me they're lightyears behind purescript |
If you want purity checking and you want to model effects in your type system, there is no alternative. Unfortunately, it doesn't do totality checking yet. That would be awesome! |
I'm sure Idris2js works as well :) |
They will probably stay in obscurity and AtScript is what you will have to do at your job in a few years. :P |
TC39 doesn't want to do half-assed (i.e.: optional/unsound type systems) types for JS, afaik. I think gradual logical types (the way flow does it) could work well for LS. |
Maybe I should really to see how sweet-js/sweet-core#421 can go without breaking the world, then try to see if I can composably add a "types" readtable thingie (oh, macro and types together, this can be but fun. Well, to be fair, success typings or gradual logical types would make it less of a pain). (GorillaScript was a contender, but has runtime type checks and very bad codegen) |
I'm longing for types. Now that it really is starting to popup both here and there in the JS community, compatibility of type system become something to have in mind - for cross-module type-checking. I do like what I've seen so far in the Flow concept. If say Flow or TypeScript was to take on, and an eco system of modules would grow, it would be nice to be compat with that. |
You don't need to reify type information unless you want to make that available for reflection. |
@robotlolita - think "non type aware foreign modules that may or may not behave" and own 'smart dynamic code' that may or may not behave in dev. phase. Some of my loose opinions: FlowType
TypeScript
Just my 2 mBTC. |
What's the status of this now? |
Have you thought about adding some sort of optional type system along with type inference?
Roy has types.
This can also be something similar to contracts.coffee, except the type checking happens at compile time instead of runtime so you don't get the performance hit.
The text was updated successfully, but these errors were encountered: