excluding features from sloppy mode
brendan at mozilla.com
Sun Dec 30 11:53:27 PST 2012
Brandon Benvie wrote:
> On Sunday, December 30, 2012, Mark S. Miller wrote:
> In the short term, while people are making the transition, the rule
> would be stated as above “If you want the new stuff, turn on strict
> mode or wrap a module around it.” Later, once ES6 is everywhere, it
> would instead be stated as "Turn on strict mode or code in a module in
> old ES3 code. No one even understands its scoping rules."
> This is a very attractive idea. It seems like it is is the simplest of
> all possible stories to learn, teach, use, specify, and implement.
Come on, you guys. Your own biases are on parade here.
First, the scoping rules of sloppy mode are know and used, some even
advocate using them in full (yes, even 'with').
Strict mode does tame *most* of the scoping crazy, I like it. But it
does not make
* free variables an early error;
* implicit conversions, e.g. random string to 0 or NaN, or anything that
can wreck your == day, an early error;
* fetching a missing property and getting undefined, which flows miles
downstream before being dereferenced, any kind of prompt error that
blames the missing property and its base object.
So exaggerating the "insane" sloppy mode's flaws both overdoes it in the
face of lots of legacy and many developers who must deal with it (some
of whom like it), *and* oversells strict mode as fixing the above
All this happy talk about teaching slogans smells like propaganda. It
won't work. It is still overcomplicated and hard to use compared to "new
syntax, just use it". And the exaggerations and overstatements will bite
back, as badly as or worse than any 'let [x] = y' breaking change.
More information about the es-discuss