On Mar 21, 2012, at 10:11 AM, Brendan Eich wrote: > Andreas Rossberg wrote: >> Right, but my comment was only about checking of assignments to const >> variables. Those are always an error, regardless of TDZ behaviour. > > Agreed, absolutely. In all-strict code we know all the bindings, we see all > assignments.
Yes, but just because a function is strict doesn't mean that everything is strict: {const c=0; with (someObj) { (function() {"use strict"}; c=2})(); } } I prefer algorithmic specifications over prose but I think it would add too much complexity to the spec. to algorithmically specify when an early error must be reported on assignments that may target const bindings. In this case I think the best we can do will be something like: If it can be statically proven prior to execution that an assignment will always result in an ReferenceError the error may be reported as an early error. However, this decrease interpretability, sone implementation might not report early errors and the program might run successfully on some implementation (with some data) and not run at all on others. If we want to require an early error then we probably need to specify the analysis that needs to be done. Other wise, some implementations will only early error on the easy cases Allen _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss