ES6 doesn't need opt-in
brendan at mozilla.com
Thu Jan 5 11:14:41 PST 2012
On Jan 5, 2012, at 9:30 AM, Allen Wirfs-Brock wrote:
> A slightly different approach to this might be to say that the use of any new syntax implies that the immediately surrounding function or program is in strict mode.
I'm favoring program currently, even if the new syntax is used in just one (of N) functions declared or expressed in the program. We could be narrow and impute Harmony opt-in only to the nearest containing function (or failing that, program). That might help incremental migration, indeed, and it seems a more locally "reasonable" rule.
But it may be that developers would benefit more from in-for-a-penny-in-for-a-pound. Hard to say without user testing.
> In other words, the default is strict mode unless the code exclusively uses ES5 syntactic constructs.
Right, but we need to settle on the unit or scale of "the code".
More information about the es-discuss