On 26 July 2017 at 18:10, Mike Samuel <mikesam...@gmail.com> wrote:

> On Wed, Jul 26, 2017 at 5:55 AM, Andreas Rossberg <rossb...@google.com>
> wrote:
> > And clearly, modes or versions only make things worse in that regard.
> Strict
> > mode already is a pig when it comes to implementation complexity (in
> > retrospect, it does not carry its weight IMHO). ES6 made it worse. Our
>
> IIRC, the primary argument for strict mode wasn't implementation
> simplicity, but the ability to do sound static analysis.
>

Right, I was merely lumping a reply to two different suggestions into a
single reply.



> var x;
> function f(a, b) {
>   a(b);
>   return x;
> }
>
> isn't analyzable because f(eval, 'var x = 1;') could cause the
> returned x to refer to a local instead of the outer x but add "use
> strict" to either scope and suddenly it is statically analyzable.
>

Actually, it cannot. An indirect call to eval cannot inject anything into
the caller scope.

On the other hand, any use of indirect eval can inject something into the
global scope, whether the caller is in strict mode or not. Overall, I thus
don't think that strict mode makes JavaScript sufficiently better.



> When you say that strict mode "does not carry its weight," are you
> saying that that the ability to do sounds static analysis doesn't
> warrant the additional complexity or are you referring to a different
> bundle of benefits?
>

The "ability to do sound static analysis" is not a binary characteristics.
You can do analysis on JS. With strict mode you have a couple more
invariants, so can do slightly better, but from my perspective it's not
even close to a game changer.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to