News for hackers. Stuff that matters.
Re:How necessary are var, let, and const? by aikah on Monday June 01, 2015 @12:31PM (#9639938)
let is obviously needed(devs like lexical scoping) but I found the whole var + let in the same language thing a bit confusing. The temptation to introduce yet another strict mode(to forbid var,and a few other constructs) is strong on this one.
Re:How necessary are var, let, and const? by seasoup on Monday June 01, 2015 @06:11PM (#9642551)
That is not at all obvious to many long time JavaScript engineers. Having a variable scoped by block or by function works for me, having both in the language is a pain. I have seen some neat tricks that you can do with let in for loops, but nothing that has convinced me it's worth the cognitive overhead of figuring out is this variable a var or a let.

My opinion is that if you use let, don't use var, and if you use var, don't use let. Either one on its own is fine, together they are just a mess.

Re:How necessary are var, let, and const? by braythwayt on Monday June 01, 2015 @12:34PM (#9639966)
var vs. let in the same language is a consequence of designing the language by committee, requiring 100% backwards-compatibility, and forbidding the addition of new modes (which is a back-door way to introduce breaking changes, while requiring browser vendors to essentially support multiple versions).
Re:How necessary are var, let, and const? by sebleblanc on Monday June 01, 2015 @02:52PM (#9641196)
That behaviour is not exclusive to standards committees. The government and private companies do it all the time.
Re:How necessary are var, let, and const? by CrossEye on Tuesday June 02, 2015 @02:29PM (#9647944)
"governments and private companies" certainly do not preclude committees. Quite to the contrary, in fact.
Re:How necessary are var, let, and const? by sesutton on Monday June 01, 2015 @12:58PM (#9640189)
>The temptation to introduce yet another strict mode(to forbid var,and a few other constructs) is strong on this one.

There is a proposal for that, coincidentally called "strong mode".

https://docs.google.com/document/d/1Qk0qC4s_XNCLemj42FqfsRLp...