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

Mark Miller erights at gmail.com
Thu Dec 18 09:15:45 PST 2014


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.



On Thu, Dec 18, 2014 at 9:09 AM, Till Schneidereit
<till at tillschneidereit.net> wrote:
>
>
> On Thu, Dec 18, 2014 at 6:01 PM, Mark S. Miller <erights at google.com> wrote:
>>
>> (1,eval)("" + function(){...strict code you want to execute sloppy...})()
>
>
> This doesn't work in SpiderMonkey: stringifying functions retains their
> strictness, no matter where strict mode is activated. In this case, the
> result would be the string 'function (){\n"use strict";\n...strict code you
> want to execute sloppy...}'
>
> It's unfortunate that this doesn't behave the same in all engines, but I
> would argue that SpiderMonkey's stringification is the more faithful one.
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
Text by me above is hereby placed in the public domain

  Cheers,
  --MarkM


More information about the es-discuss mailing list