-
-
Replying to @sebmarkbage
I believe JS engines can optimize perf of const vs let – so there might be more to this other than what was said in that thread.
3 replies 0 retweets 4 likes -
Replying to @trueadm @sebmarkbage
It's pretty trivial to check if a binding never changes regardless of it being a let or const. Babel has an API for ut
2 replies 0 retweets 0 likes -
Replying to @amasad @sebmarkbage
It’s easy to scan AST for it, but VMs might not check ahead for the binding due to lazy/eager parsing heuristics.
1 reply 0 retweets 1 like -
If the best thing to be said for const is magic AOT heuristic because browsers won't scan for, even in JIT tiers, it's a poor feature.
1 reply 0 retweets 1 like -
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
2 replies 0 retweets 3 likes -
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 -
If the advice is "if you want to mutate, go ahead and change it to let", it makes it much easier to mutate something you shouldn't have.
1 reply 0 retweets 0 likes
I use const to mean "if you're mutating this binding, you're doing something wrong" rather than "it happened to not be mutated"
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.