excluding features from sloppy mode

Mark S. Miller erights at google.com
Sun Dec 30 07:51:09 PST 2012


On Sun, Dec 30, 2012 at 3:39 AM, Axel Rauschmayer <axel at rauschma.de> wrote:
> I agree. To me it comes down to cognitive load. A good way of measuring that
> is whether one can state a simple rule. For Andreas’ approach, it would be:
> “If you want the new stuff, turn on strict mode or wrap a module around it.”

+1. The expository benefit of this kind of simple rule is huge.


> - Pro 1JS: You can use new stuff everywhere.
> - Contra 1JS: You can’t use all of the new stuff. There are tricky
> exceptions and rules.

Here, Axel and Andreas repeat the mistake I made about the definition
of 1JS. The above “If you want the new stuff, turn on strict mode or
wrap a module around it.” rule is perfectly consistent with 1JS as
Dave has clarified it (and as he originally stated it).


> Another thought: What will JavaScript code look like once 99% of browsers in
> use support ES6? Will we have a language with coherent semantics and a
> simple structure? That is: is there a way to drop some of the trickiness,
> long term? And which of the approaches gets us there?

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
order to code in JavaScript. If you don't, you'll be coding instead in
an insane JavaScript fossil that exists merely for compatibility with
old ES3 code. No one even understands its scoping rules."


More information about the es-discuss mailing list