On Tue, Sep 30, 2014 at 6:38 AM, Jason Orendorff <[email protected]> wrote:
> On Mon, Sep 29, 2014 at 4:14 PM, Rick Waldron <[email protected]> > wrote: > > Can you clarify "write"? Does this mean assignment? > > Yes. > > > Why would assignment throw? > > Assigning to an uninitialized variable is an error in ES6. A > let-binding is initialized when its declaration is evaluated. So this > is OK: > > let x; // no Initializer, so it's initialized to undefined > console.log(x); // logs undefined > > but this is not: > > init(); > let answer; > function init() { > answer = 42; // throws ReferenceError > } > My original response questions were poorly asked. I understand the TDZ semantics, but I couldn't reproduce anything meaningful from your original example, because I don't have the SpiderMonkey build that includes the let updates (presumably Nightly doesn't either, because none of these can be reproduced there). I'm trying to understand when/where/why/how the original example could happen and what the potential consequences are in terms of practical application. Rick
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

