ES6 doesn't need opt-in

Andreas Rossberg rossberg at google.com
Wed Jan 4 04:12:53 PST 2012


On 3 January 2012 21:01, Brendan Eich <brendan at mozilla.com> wrote:
> On Jan 3, 2012, at 1:29 AM, Andreas Rossberg wrote:
>> On 3 January 2012 07:21, Brendan Eich <brendan at mozilla.com> wrote:
>>> The top level is hard. The only way to be sure is to use pure lexical scope (in Dave's proposal, use module {...}).
>>
>> Ah, but wrapping into modules is incompatible with having multiple
>> script parts.
>
> I don't know what you mean. "Incompatible" in the sense that you cannot transform multiple scripts into multiple anonymous modules?

Yes.

>> For multi-part scripts we need a way to switch the
>> _proper_ top-level into extended mode. Or should I not be able to
>> write (the relevant bits of) a multi-part script in extended mode at
>> all?
>
> The proposal may have been unclear on this point: the top level would allow as much new syntax and semantics as can be tolerated backwards-compatibly. The hard cases are let, lexical scope in the free-variables-are-errors sense Dave described (extant globals at start of module body are imported), and any runtime shifts we want (completion reform, typeof null).

I suspect there may be other subtle issues, e.g., what about `const'
and local functions? [I see, Allen mentioned that already.]

In any case, even if we allow more features in classic mode, that
still doesn't give you the ability to use _all_ Harmony features for
multi-part scripts. I think we need a proper story for this.

[I just saw that later down the thread Mark proposed reusing strict
mode as an opt-in for full Harmony. I reply to that separately.]

/Andreas


More information about the es-discuss mailing list