non-ES5 strict mode restrictions
brendan at mozilla.com
Mon Jun 20 11:40:09 PDT 2011
On Jun 20, 2011, at 11:17 AM, Mark S. Miller wrote:
> Wow, good catch. That's an oversight -- I don't remember this case being noticed when we discussed this issue. I agree with your conclusion on three grounds:
I remember this, or at least, I remember discussions about it. It's no different from var in strict eval, AFAICT. I think the spec has enough information to reach the conclusion that no exception should be thrown.
> a) The anticipated cases of the prohibition in the note only narrows the Chapter 16 exemptions -- it only restricts how one can extend the language beyond what ES5.1 allows. This recommendation can therefore be followed by implementations that still fully conform to the letter of the ES5.1 spec. If we interpret the note the way you suggest, we preserve this compatibility. Otherwise, the note and the letter of the spec come into conflict.
> b) The text of the note recommends "Do not allow a FunctionDeclaration to occur in a Statement context." In your example, the FunctionDeclaration appears in a Program production as a SourceElement. This is not a Statement context.
> c) The hazard that motivates the note does not occur in this case, so there's no reason to stretch the restriction to apply to this case.
> So your conclusion in consistent with (a) the letter of ES5.1, (b) the letter of the note, and (c) the spirit of the note.
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss