News for hackers. Stuff that matters.
Re:An update on strong mode by dangoor on Monday February 22, 2016 @09:14PM (#11155976)
Wouldn't const be checked at compile time?
Re:An update on strong mode by venning on Monday February 22, 2016 @09:21PM (#11155999)
That's still a check that var is not subject to. Hence, it's a little slower (in theory).
Re:An update on strong mode by phpnode on Tuesday February 23, 2016 @03:11AM (#11157335)
In theory, the opposite, because a compiler knows that a constant binding never changes so the value it references can be inlined everywhere it is used without having to do runtime checks. But I think engines are not doing this yet.
Re:An update on strong mode by venning on Tuesday February 23, 2016 @03:23AM (#11157372)
I haven't written enough ES6 to answer this for myself, but doesn't the dynamic nature of the language mean that constants can be at risk of invalid LHS operations at run-time? (At least, those positioned high enough in the scope to be subject to the necessary operations, which could be a lot.) I'm thinking of eval specifically, but perhaps there are other ways of doing this.
Re:An update on strong mode by david-given on Tuesday February 23, 2016 @05:24AM (#11157894)
I think if you use eval, all bets are off anyway.

But I think that in ES6 without eval you can't refer to the current scope in a dynamic way; which means that the engine can resolve bindings at compile time without worrying about people fiddling with scopes behind the scenes, which should simplify optimisation a lot.