3 ms·
Coffeescript isn't consistent. setter = (arg) -> store = arg store = 'initial' is quite different from store = 'initial' setter = (arg) -> st
by emn13 13y ago
Coffeescript isn't consistent.
setter = (arg) -> store = arg
store = 'initial'
is quite different from
store = 'initial'
setter = (arg) -> store = arg
This is a practical problem since it means that the most commonly used JS encapsulation feature - closures - become harder to write. Suddenly assignments that have no direct influence on each other cannot be blindly reordered (which is a pain), and in particular closures that have a bunch of helper functions defined initially that need to ensure that local variables are set before the helpers, even if those local variables are themselves functions.
It's just a mess. Frankly, I think javascript does this part a lot better than coffeescript, especially now that "use strict" exists and you can get some feedback when your scoping assumptions turn out wrong, rather than a silent failure and unexpected behavior.