Can someone please explain to me what bug people think they are catching by choosing `const` in ES6 programs over `let`?
@keithwhor how can v8 do better if you type const vs typing let and not mutating the binding?
-
-
@wycats upon first glance, why not do so? -
@keithwhor the reason not to use const is that let already protects you from casually reusing the binding. -
@wycats casually reusing by redeclaration, sure. But I think the idea is to follow old best practices and keep variables declared at the... -
@wycats ... Top of their respective blocks. Const then gives a developer perusing your code immediate context as to what might happen -
@wycats I think it had more to do with readability, flow and intention than it does with execution. -
@keithwhor if your style is never to mutate the bindings, what is let buying you? Sounds like you want to teach ppl to const instead? -
@wycats ... I probably don't want a developer reassigning my factories or "classes" -
@keithwhor so you're protecting your bindings from future developers on your team? - 1 more reply
New conversation -
-
-
@wycats but the fact is we have to expect other developers are going to need to discern our intentions, and if we can make that easier -
@keithwhor I'm not sure which intention is unclear. Either the developer typed "x = newval" to mutate or they didn't
End of conversation
New conversation -
-
-
@wycats if you're a seasoned developer and you're only ever writing your own code, I'd say always use letThanks. Twitter will use this to make your timeline better. UndoUndo
-
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.