excluding features from sloppy mode

Brendan Eich brendan at mozilla.com
Fri Dec 28 12:20:23 PST 2012

David Herman wrote:
> On Dec 28, 2012, at 3:01 AM, Kevin Smith<khs4473 at gmail.com>  wrote:
>> I'm tellin' ya, no one's going to write any significant non-module code.  : )
> +9001 (to quote rwaldron)
> We should hold the line against any implicit opt-in beyond modules. Mark argues that classes are coarse-grained, but they can easily be significantly finer-grained than modules. In particular, they're an expression form and can be used for tiny little one-offs:
>      var f = new (class() { m(x) { } })();
> Modules are the largest-grain code structuring form, and they are the *biggest biggest biggest* carrot we have to offer for strict mode.

I get nervous when speculations about future adoption ratios or 
incentives for developers are made without enough data or table-stakes 
ante'ing (bolded tripled *biggest* doesn't count as money!).

I've seen Kevin make wildly optimistic assertions about future Node 
adoption of modules, but from what I know of the "Amish coders" who 
dominate there (and believe me I am not mocking, there's much to admire 
about the Amish, farmers and coders!), adoption will be a fight, as 
Russell suggested.

> I'm fine with adding a "use strict"; pragma to classes, but it's also just as easy to place them in a strict context, either by putting them in a module or a strict function.

It's easy to place things in a strict context if you mean place in a 
module. But per your own argument, outside a module it's much easier to 
forget to "use strict'; and make sloppy-mode classes.

Same yardstick should apply to all future measure-guesses of adoption 
and ease of strictness.

If you assume modules are biggest^3 then sure, what you and Kevin 
surmise will happen is likely: classes appear in modules almost 
exclusively, and are thereby implicitly strict.

But this assumption does not prove itself, and more bold-*'ed assertions 
on top make me more skeptical.

I bet modules will be a big carrot. But -- especially if Node does not 
switch NPM to ES6 modules for a while -- classes could proliferate 
outside of modules. I do not know and I'm not willing to add a "use 
strict"; pragma special case to ClassElement on the theory it will be 
remembered, when our shared theory outside of modules is that it will 
likely be forgotten. That just does not seem like same-yardstick 
future-speculative reasoning.


More information about the es-discuss mailing list