Re:How necessary are var, let, and const?
by jonny_eh on Monday June 01, 2015 @04:07PM
(#9641759)
Aren't points 1 and 2 just arguments for a stricly typed language?
[ Parent
| on HN ]
Not at all. Simple things like instanceof / typeof checks can be resolved without a static type system. Because with a const everything is known about the const in question. Obviously the const prototype may change but then again if the const has a frozen prototype - that too can have static analysis applied to it.
I am simply repeating the well-known benefits to immutables which is completely orthogonal to a type system, static or otherwise.
instanceof cannot be determined statically because I can do...
const a = {};
Object.setPrototypeOf(a, SomethingElse);