3 ms·
This presentation makes me want to punch the next person I see https://drive.google.com/file/d/0B1v38H64XQBNT1p2XzFGWWhCR1k/view https://drive.google.com/file/d
by mavdi 12y ago
This presentation makes me want to punch the next person I see
https://drive.google.com/file/d/0B1v38H64XQBNT1p2XzFGWWhCR1k/view https://drive.google.com/file/d/0B1v38H64XQBNT1p2XzFGWWhCR1k...
"let is the new var". No it's fucking not! "let" promotes procedural block scoped code. Moves people away from thinking properly about flow in their code. "var" has it's places, "let" can be a good addition is SOME circumstances. And calling code with "var" in it as insane, is itself insane.
- BrendanEich 12y agoWhat is "procedural block scoped code" and why do you think var as a binding construct (ignoring the initialiser) is control-flow sensitive? It's not. /be
- mavdi 12y agoI mean people will widely use for, while, switch statements instead of maps, hashes, weak maps etc. They will be setting variables in parent scope, procedural step by step thinking, rather than passing functions, chaining things etc. I personally don't like some of the ES6 additions, but this one is just a step too far. For us mere mortals that is.
- BrendanEich 12y agolet composes nicely with all the statement forms. You can even do `for (let x ...)` and have a proper let binding per iteration, for closures that capture x in the body. /be
- mavdi 12y agoYep and it's awesome to have that but I personally hardly ever use for loops.
- tree_of_item 12y agoI don't really understand what you're saying here. `let` is the way JavaScript should have worked from the beginning: a sensible implementation of lexical scope. How can you possibly make an argument for `var`? What is "procedural block scope"? Why does a proper implementation of lexical scope damage "thinking properly about flow"? I just don't get it.