I personally like using const and don’t see any issues mentioned in the thread to affect me. I used to love the idea of immutability too
-
-
The main issue with overusing const is that you lose the user intent of "this ought not be mutated" as in const fs = require('fs')
2 replies 0 retweets 0 likes -
I’ve spent the last few months working on partial evaluating React code via Prepack. So I probably see JS in a different way to most haha
1 reply 0 retweets 0 likes -
It's very easy for prepack to apply the "un-mutated let binding" optimization and I really hope you do.
1 reply 0 retweets 0 likes -
It’s not that easy. Nothing is safe from side effects it seems. The only somewhat safe thing is strict type annotations
2 replies 0 retweets 1 like -
What exactly is not easy. Are you referring to use of direct eval? Or something else?
1 reply 0 retweets 0 likes -
Global side effects, eval, getters/setters, proxies etc.
1 reply 0 retweets 0 likes -
How can global side effects, getters/setters or proxies affect the analysis of whether a let-bound variable in a module is ever mutated?
1 reply 0 retweets 1 like -
I wasn’t talking about mutating the binding, rather the object the binding referenced.
1 reply 0 retweets 0 likes -
Right. I'm saying you can easily apply an optimization that treats un-mutated let bindings as const and should.
2 replies 0 retweets 0 likes
You wouldn't apply that optimization in the presence of direct eval, which is static.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.