Kevin Smith wrote:
The more I think about this, the more convinced I get that all new
syntax and breaking changes (where possible) should be strict-mode
only. In retrospect, `let[x] = y;` changed everything. Here's why I
think "1JS under strict" is the best solution:
- How exactly would one teach that classes, arrows, etc. are all
available in sloppy mode, but "let" is not? The reason is obscure for
a casual user. It's going to seem arbitrary. On the other hand, "1JS
under strict" is quite easy to teach.
Ease of teaching != successfully imparted knowledge at scale. Sorry, but
it's true. People don't use "use strict"; at top level enough, and
teaching them all will take time. Even then, because of the Law of Least
Effort, it'll be left out.
This is the major objection some of us keep raising, and you don't
engage with it. Please do!
- It creates a clean, linear evolution for javascript syntax: ES3 >
ES5 strict > ES6 > ES7.
I would use < for that relation, but it's not a subset relation due to
the non-early-error, runtime-semantic-shifts of ES5 strict.
Also, enough pretty (if inaccurate) diagrams! User-facing complexity,
developer ergonomics, usability matter more than Platonic prettiness.
There, I said it :-P.
- It eliminates the so-called "micro-modes" in function heads.
A canard, or at most a quibble about banning duplicate formals in the
present of destructuring, which I am prepared to negotiate away. Please
don't repeat it carelessly.
- It gets everyone moving in the same direction: strict mode.
In your dreams, but in reality the sprawl is large and in several direction.
- It eliminates subjective questions about what constructs should be
implicitly strict.
There's nothing subjective about such questions, any more than your
contentions about strict mode being objective. In practice people will
not use strict when they might, and making ES6 features available only
under "use strict" will, ceteris paribus, lead to less adoption of ES6
than otherwise.
To be clear, I'm proposing that:
1) All new syntax
New syntax is not a breaking change (as you use that phrase).
and breaking changes (where possible)
Why the "(where possible)"?
are strict-mode only.
If you believe in strict mode so strongly, why not make all new syntax
with a body-form be implicitly strict in that body's code?
2) Modules and only modules are implicitly strict.
Whew! You seemed to throw this out in your lede, really till here.
Why not?
Lurkers out there! Would anyone be opposed to opting-in to new ES6
syntax by either (a) "use strict" or (b) modules?
I know, you're tired of hearing from me. I'll subside for a while.
However, you know there are issues with strict mode, not all
"superstition". Ignoring them, pretending they do not hamper adoption,
dodges the central objection to your proposal: that by yoking ES6
feature adoption to strict mode adoption, you multiply risks and reduce
ES6 adoption.
/be
{ Kevin }
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss