Re: ES6 “modes” and user-friendliness

Axel Rauschmayer axel at rauschma.de
Tue Jan 17 00:06:21 PST 2012


> I think you've misunderstood. There's nothing in my New Year's email about "getting ES6 semantics" when you find an occurrence of a particular feature (that kind of thing was just a side conversation in the mega-thread, and a very ill-conceived one IMO). The proposal is that within the context of a module, you get a few small changes to the semantics **for the code within the module** -- and nothing else. There's no scanning for particular features. There's no language version detection. There's no versioning at all. ES6 is an update to the language like every other edition of ECMA-262 has been. Browsers don't have ES3 modes and ES6 modes. They just have ECMAScript.


Ah, that makes sense, the thread you mentioned got me confused. Then for language implementors, there are three modes/semantics:

1. module => ES6 – some changes break with ES5.strict
2. "use strict" => ES5.strict + all ES6 constructs that are backward-compatible
3. otherwise => ES3 + all ES6 constructs that are backward-compatible

It’s a tiny bit messy, but I can see that for developers, the illusion of a single ES6 is more or less intact. Seems like the best possible solution.

Given that most people are bound to use modules and given that they are a very convenient “switch”, wouldn’t it be best to introduce as many breaking changes via #1 now (as opposed to later, in ES7 etc.)? Especially removing window from the scope chain.

Mark’s email [1] seems to suggest just two modes (#1 being a superset of #2 = subsuming it), but using module as a switch, distinguishing #1 and #2 might be worth it.

[1] https://mail.mozilla.org/pipermail/es-discuss/2012-January/019195.html

-- 
Dr. Axel Rauschmayer
axel at rauschma.de
twitter.com/rauschma

Home: rauschma.de
Blog: 2ality.com



More information about the es-discuss mailing list