3 ms·
The good news for fogus is that everyone who prefers CoffeeScript validates the idea that an alternative syntax is enough of a win to be worth the adoption head
by raganwald 16y ago
The good news for fogus is that everyone who prefers CoffeeScript validates the idea that an alternative syntax is enough of a win to be worth the adoption headaches.
- hasenj 16y agoIt's not just syntax, but some semantics too. Last expression in a function is returned. This includes assignment statements which are in fact expressions. foo = () -> a = bar() z = () -> if a b = fu() else b = kar() Here, foo returns the function z, and z returns either fu() or kar() while assigning the value to b One could argue this is just syntax but I think this way beyond the kind of thing that comes to mind when somebody thinks of "syntactic sugar".
- Homunculiheaded 16y agoDespite all of the weirdness of JavaScript, the lack of implicit return is it's biggest design flaw imho. The functional/scheme-like virtues of JS are well touted, but this small missing feature means implementing them always requires the slight but constant overhead of ending every expression with 'return', which then means that programming in a way which should be natural to javascript, isn't.
- jashkenas 16y agoFYI, you don't have to include an empty parameter list for defining functions that don't take any arguments. Just the arrow will do. foo = -> a = bar() z = -> if a b = fu() else b = kar()
- irahul 16y agoBut whatever he is after have to be much more lucrative than writing coffeescript. Apart from pleasant syntax, coffeescript also improves upon semantics where it can - this binding, lexical scoping etc etc. People are willing to adopt Coffeescript because it compiles to javascript, it has improved semantics and clean & mostly familiar syntax. To sum it up, the inertia is small when moving from JS to cofffeescript. That doesn't look like the case with funode.