jason.orendorff at gmail.com
Tue Dec 20 13:45:19 PST 2011
On Mon, Dec 19, 2011 at 12:21 PM, Xavier MONTILLET
<xavierm02.net at gmail.com> wrote:
> And what do you mean by "opt-in for ES6" ? New syntax ? Everything in ES 6 ?
Not everything. Let me try to explain the opt-in.
ES6 must not break existing code. This is non-negotiable. Nobody will
use a Web browser that breaks the Web.
However, a few of the ES6 proposals are impossible to accept, for this
very reason... unless there is an opt-in. Since no existing code
contains an ES6 opt-in, any new features that are enabled by the
opt-in can't break existing code.
As I understand the current proposals, opt-in will be required for scripts that
- use the new 'module' keyword,
which isn't reserved in ES5;
- expect (typeof null) to be "null",
rather than 'object' as in ES5;
- need the top-level scope to be declarative,
rather than tied to the global object as in ES5; or
- declare functions in Blocks,
with nice standard semantics, different from current
browsers which all do it a little different.
...precisely because these are the features that could otherwise
change the behavior of existing code. All other new features will be
available whether you use the opt-in or not.
Now: in order for TC39 to ditch the opt-in, they would have to either
ditch these four features ... or somehow make the new syntax totally
distinct from all existing code, so that existing code doesn't break.
Here is what I might do:
- keep modules, but change the syntax to
eliminate the 'module' keyword,
use an ES5 ReservedWord, or
make 'module' a contextual keyword
(lots of options here, none pretty);
- give up on typeof null;
- keep top-level declarative scope, but
only in module code;
- specify less-nice, more-Web-compatible
semantics for functions in Blocks
More information about the es-discuss