What would a 1JS-friendly strict mode look like?

Till Schneidereit till at tillschneidereit.net
Thu Dec 18 09:26:45 PST 2014


On Thu, Dec 18, 2014 at 6:15 PM, Mark Miller <erights at gmail.com> wrote:
>
> I didn't know that SpiderMonkey did that, but I agree it is better. In
> light of this news, I'm glad my code sample doesn't work ;).
>
> As for "would be good for all engines to act the same", the
> precondition was carefully crafted so that engines did not need to
> retain the original source, but rather, just enough for behavioral
> equivalence. Nevertheless, if we could get everyone to agree on
> SpiderMonkey's behavior here, it would be better. Too late for ES6
> though.
>

SpiderMonkey does retain the original source. However, it adds the "use
strict" if the function is defined in a strict-mode scope. Reading the
rules for Function.prototype.toString, it's clear that not doing that is
valid, as the spec only requires behavioral equivalence "if the string is
evaluated, using eval in a lexical context that is equivalent to the
lexical context".

So yes, it would be nice to get agreement here, but it's not as important
as I first thought.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141218/a633906e/attachment.html>


More information about the es-discuss mailing list