2 ms·
> The js and coffeescript ways of handling this seem both to come down to the assignment operator being used for both creating bindings and mutating them That
by masklinn 13y ago
> The js and coffeescript ways of handling this seem both to come down to the assignment operator being used for both creating bindings and mutating them
That is not quite the case in javascript, `var` creates a binding (also `let` in ES6), and assignment assigns to the binding.
There is the issue that assigning to an non-existant binding creates a global one, but strict mode will turn it into an error and linters have little issue recognizing and warning against it either.
- jayferd 13y agoHm, but it seems to be a runtime error. Is there a transpiler or other tool that will give you static errors if you try to set an out-of-scope variable?
- masklinn 13y ago> Hm, but it seems to be a runtime error. Yes, it's still javascript. > Is there a transpiler or other tool that will give you static errors if you try to set an out-of-scope variable? Elm and Fay likely do.
- jayferd 13y agoJust asked about this on #altjs, and it looks like TypeScript will actually give you a static error if you try to assign to a free variable.