ES6 doesn't need opt-in

Allen Wirfs-Brock allen at wirfs-brock.com
Fri Jan 6 00:24:31 PST 2012


On Jan 6, 2012, at 12:00 AM, Mark S. Miller wrote:

> On Thu, Jan 5, 2012 at 11:47 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>> 
>>     1) program using only ES3 features and no "use strict";
>> 
>>     2) program using only ES5 strict features and saying "use strict";
>> 
>>     3) program using ES6-only features.
>> 
>> Do these three programs operate in three different modes? If not, do #1 and #2 operate in the same mode, or do #2 and #3 operate in the same mode?
> 
> It isn't about "modes".  #1 and #2 are ES5 programs and are processed as such (applying/not the appropriately strictness as per ES5) . #3 is an ES6 program is processed as such (including using the strict semantics that are universal to ES6).
> 
> Ok, is there any observable difference between what you would have future browsers do, vs the equivalent mechanisms except that program #2 is categorized as an ES6 program and processed as such?
> 
> If there is no observable difference, good. Then it's only a matter of how we describe an agreed semantics. If there is an observable difference, how is this not three modes?

There should be no observable difference.  But the issue isn't how we described the (program) semantics.  It is how we decide which semantics to apply.

The tricky cases are thing like:

function f(a) {
    arguments[0]=2;
    return a
}
print(f(1));  //2 if ES5, 1 if ES6

There is nothing in the source file that implies which specification to apply so for backwards computability a browser must default to interpreting such program as a ES5 program. Anything syntactically unique to ES5 (eg, use of a with statment) or ES6 (eg, use rest or spread) would force one interpretation or another

Allen







> 
>  
> -- 
>     Cheers,
>     --MarkM

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120106/15284faa/attachment.html>


More information about the es-discuss mailing list