by jashkenas · 12y ago · 0 comments
Fortunately, CoffeeScript is open-source, and can be both easily changed, and easily forked to suit your fancy. There are very nice versions (LiveScript and Coco, for example), that change this behavior by introducing two different types of assignment — if that sort of thing is your cup of tea.
... and if anyone has a specific proposal about how they'd like to see this feature changed in order to improve it, feel free to open a ticket for discussion — it could very well happen. For example, making this:
topLevelFunction = ->
path = "a/b/c"
... many lines of code go here ...
path = require('path')
... into a compile-time error, with some sort of "Subsequent variable shadows `path`" warning, that would be something worth talking about.As to the ticket; A quick search would have revealed there are many tickets on the topic of shadowing: https://github.com/jashkenas/coffee-script/search?q=shadowin...
And this ticket covers this specifically https://github.com/jashkenas/coffee-script/issues/2697 and was closed.
LiveScript is interesting, but seems to have Too Many Features for my tastes.