You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to enforce immutability? I know that the team chose to use var instead of scoped variables like const and let, but it would be nice for the compiler to detect if there has been a re-assignation and show an error at compile time to prevent it.
The text was updated successfully, but these errors were encountered:
I think #4985 is the main issue discussing supporting const. Basically it’s not supported currently, but there are ways that support could be added (like via new syntax such as := instead of =); however there’s debate as to whether this violates the spirit of CoffeeScript where one of the original tenets was that you shouldn’t need to think about whether a variable is being declared versus assigned.
The way I see this that may not violate the "const" assignment is that we keep using var, however, internally coffeescript could have a reference of all the variables that have been declared, if the variable has more than one assignment then show a warning or error during compilation. IMO I don't care if I'm using var, let or const, I just don't want to assign a value to a variable more than once. So I see it as a feature of coffeescript rather than a transpilation option.
Is there a way to enforce immutability? I know that the team chose to use var instead of scoped variables like const and let, but it would be nice for the compiler to detect if there has been a re-assignation and show an error at compile time to prevent it.
The text was updated successfully, but these errors were encountered: