Closed allenwb closed 6 years ago
As much as I'd be happy to have as many things immutable as possible, it's hard for me to understand the intuition behind this particular context making function declarations becoming suddenly immutable. Even if there's a keyword to make things more obvious, I was expecting everything else to be the same.
I think many people are surprised to find out that they’re mutable in the first place, tho. I’m always surprised when i rarely find code that mutates them.
This proposal ended up not including lexical bindings.
I'm not really pushing this idea, but I thought it should at least be captured.
It would be easier for humans and machines to reason about what is going on in class bodies if the bindings created by class body level lexical function declarations were immutable.
This creates an inconsistency between the handling of class body function declarations and function declarations in other scopes. I'm pretty uncomfortable with that inconsistency. However, if we think that a class body is so different from other scoping context that declaration need some sort of special prefix then consistency concerns seems to be out the window, so why not make the binding immutable.