ES6 doesn't need opt-in

Andreas Rossberg rossberg at
Thu Jan 5 06:31:20 PST 2012

On 4 January 2012 21:52, Brendan Eich <brendan at> wrote:
> On Jan 4, 2012, at 4:23 AM, Andreas Rossberg wrote:
>> - Despite the superficial "fewer modes" mantra, it actually doesn't
>> make the language simpler, but more complicated: instead of defining
>> the semantics for Harmony features only for strict-mode programs, we
>> now have to define many features for both modes (and mixed uses of
>> both modes). I.e., there are more syntactic and semantic combinations
>> to worry about.
> Yes, this is a trade-off. It probably helps developers migrate, provided they choose sane combinations. For example, Allen (private correspondence) wondered if a function using the arguments object is evolved to have destructuring parameters:
>  function f({a,b}, c) { arguments[0] = {a:3,b:4}; return [a, b] }
>  f({a:1,b:2}, 3);
> I say anyone wanting deep aliasing (f returns [3, 4]) should suffer disappointment. I doubt developers want such deep aliasing, and no implementor does.

Whoa, yeah, please let's not go there.

>> - All this together (new features in old mode,
> Nope. ;-)
>> implicit opt-in,
> Yup.
>> explicit opt-in)
> No -- "use strict"; the string literal expression-statement is meaningless pre-ES5, ES5-strict in ES5, and redundant in Harmony code.

You said earlier that we best rely on the meta tag for the script
toplevel, which isn't exactly a No. ;)

> Now what do you say?

Sorry, I still think that a growing set of subtle implicit rules for
activating subtle semantic changes on a fine-grained level is far more
confusing (and error-prone!) than helpful. In all sorts of ways.

I'm also concerned about the 3 and a half language modes that might
result. With Dave's original proposal at least, the only opt-in was on
module level. That precluded a number of highly undesirable
combinations, e.g. extended mode nested into a "with" statement. Allen
gave a couple of good examples we also ran into when trying to
implement block scoping liberally in V8 -- in the end, we concluded
that it doesn't make sense to allow opting into extended mode locally.


More information about the es-discuss mailing list