Re:Announcing CoffeeScript 2
by dugmartin on Monday September 18, 2017 @03:08PM
(#15278605)
I felt the same way when I switched from CoffeeScript to TypeScript but the type checking was worth all the braces, returns and lack of existential operator. If CoffeeScript added an (optional) type system I'd switch back in an instant.
[ Parent
| on HN ]
Re:Announcing CoffeeScript 2
by GeoffreyBooth on Monday September 18, 2017 @04:02PM
(#15279014)
It’s not elegant, but there is a way to do type checking in CoffeeScript: http://coffeescript.org/#type-annotations
This is cool! That being said, it would be very nice to have (optional) syntactically more beautiful type annotation. I assume Flow must be compatible with regular javascript, but CoffeeScript could take more flexible approach. I have no idea what the actual syntax could be, though.
Thanks for the link. :)
But wow, "not elegant" is an understatement.
> If CoffeeScript added an (optional) type system I'd switch back in an instant.
The home page talks a little about achieving this by using Flow annotations in Coffeescript source and then having the build system pass the Javascript output to Flow: http://coffeescript.org/#type-annotations
That would be really nice, but CoffeeScript will probably not be adding types unless they start adding them to JavaScript.
It is a dilemma, but so far I have gotten by without type-checking.
Re:Announcing CoffeeScript 2
by vanderZwan on Monday September 18, 2017 @03:46PM
(#15278892)
Well, guess it's time for someone to build yet another layer of abstraction by writing a typed superset that compiles-to-CoffeeScript then!
(I'm joking, but actually.. why not?)
call it ToffeeScript - a dialect of CoffeeScript that transpiles to TypeScript?
I'm afraid you're a few years too late!
You might like LightScript: http://lightscript.org
Good interop with Flow isn't quite there yet, though.