excluding features from sloppy mode

Brandon Benvie brandon at brandonbenvie.com
Fri Dec 28 13:10:44 PST 2012

So to speculate, what are the costs and benefits? Earlier in this thread I
said a cost of putting things in strict mode is in increasing the semantic
gap between otherwise identical code (besides the pragma), and the cost of
not doing so it in any compatibility constraints (such as block scope
function decls). To further that, I think the general concensus seems to be
that a cost of not putting things in strict-mode only is that it implicitly
encourages not using strict-mode, which is not desirable.

The cost above, increasing the semantic gap, doesn't exist when it's about
completely new function forms. The costs involved with *calling* a strict
function already exist and are a sunk cost, since in theory any time you
use third party code you could be calling into a strict function and all
that entails. 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.

Brendan Eich wrote:

> David Herman wrote:
>> But even if*not*, it's not worth proliferating the number of cases that
>> are implicitly strict.
> But why isn't it worth the proliferation cost to get the benefit of
> strict-by-fiat classes if those proliferate outside of modules?
> To answer that, you have to speculate on costs and benefits of strict mode
> for classes outside of modules, not talk about modules more:
>    Modules are a good place to implicitly opt in to strict mode, because
>> they're a coarse-grained program structuring feature.
> And granularity of class vs. module can't matter under the "even if *not*"
> hypothesis we are exploring together in this branch of future-reality:
>  Classes are finer-grained, especially dynamic classes like in ES6.
> The question really is, why have sloppy-mode classes at all? Who wants or
> needs them?
>  Meanwhile we don't*need*  the world to use strict. Modules will reinforce
>> strictness on a large scale; classes provide much less reinforcement, and
>> more complexity. Not worth it.
> (This just rehashes your assumption and the conclusion we agree follows
> from it!)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121228/55645bde/attachment.html>

More information about the es-discuss mailing list