Assigning to globals in strict mode

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Tue Oct 19 18:07:05 PDT 2010


I'm here but trying, to sort out what, if any the issues are and there are so many messages to plow through.  Could somebody relist the specific issues or questions of concern.   BTW, harmony issues are all speculative at this time.  The only standard we have is ES5 that that is the one we need to be conforming to (or identify any real errors).

Allen

> -----Original Message-----
> From: es5-discuss-bounces at mozilla.org [mailto:es5-discuss-
> bounces at mozilla.org] On Behalf Of Maciej Stachowiak
> Sent: Tuesday, October 19, 2010 5:54 PM
> To: Brendan Eich
> Cc: Mark S. Miller; es5-discuss es5-discuss at mozilla.org
> Subject: Re: Assigning to globals in strict mode
> 
> 
> On Oct 19, 2010, at 5:36 PM, Brendan Eich wrote:
> 
> > On Oct 19, 2010, at 4:22 PM, Oliver Hunt wrote:
> >
> >> On Oct 19, 2010, at 4:19 PM, Maciej Stachowiak wrote:
> >>
> >>> If Harmony is going to require the other behavior, how about an erratum to
> make ES5 strict mode the same? There doesn't seem to be much reason to have
> a future behavior difference here.
> >>
> >> In harmony you have a purely lexical scope, eg. the global object is not at the
> head of the scope chain.  That means all unqualified names can be resolved
> statically so all these errors become early errors.
> >>
> >> In ES5 there is both with() and the global object that make early errors
> incompatible.
> >
> > Exactly. (BTW, do people use "head" for the far end of the scope chain? I try to
> be consistent in using "tail", myself... ;-)
> >
> > Plus, ES5 is "done". Sure, there are errata and will be more. But too many
> errata, especially "big" ones (even if "small" in spec language terms; I mean by
> "big" that they have significant implications for implementors and possibly for
> other parts of the spec, without enough time to study the big picture), seem
> likely to cause trouble.
> 
> Just to make sure I'm clear on this, will the following program have the same
> effect in ES5 strict mode and Harmony, or no?
> 
> "use strict";
> var declared = 0;
> undeclared = declared++;
> 
> My understanding is that in ES5 strict mode, declared ends up 1, but in Harmony
> it ends up 0. In both cases, undeclared is left undefined. Is that correct? Or
> maybe by "early error" you mean it's a parse error and therefore in Harmony,
> declared will not be defined at all.
> 
> Regards,
> Maciej
> 
> _______________________________________________
> es5-discuss mailing list
> es5-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es5-discuss



More information about the es5-discuss mailing list