excluding features from sloppy mode
brendan at mozilla.com
Fri Dec 28 14:11:34 PST 2012
Brandon Benvie wrote:
> So I don't see what costs are associated with making new function
> forms implicitly strict. In fact, I see the reverse: by allowing them
> to have two modes, you *create* that very cost same cost. If these new
> forms only have one mode then they will be *simpler* than regular
> function declarations/expressions, along with the added benefits of
> listed above of enforcing strict mode.
Yes, if new forms with distinct heads are strict-by-fiat, then one could
argue that ES6 is simpler. But a counter-argument is that people have to
know in hard cases, not just caller calling could-be-strict callee, but
when maintaining code and doing things like adding arguments or 'with'
uses (not kidding -- latter is early error, former could lead to trouble).
The counter-counter-argument is that usually strict mode is saner and
better and the sloppy vs. strict runtime semantic shift (w/o early
errors) hard cases should not "make bad law". They should remain hard
for the greater good of more strict code over time, due to more modules,
classes, generators and arrow functions.
More information about the es-discuss