ES6 doesn't need opt-in

Axel Rauschmayer axel at rauschma.de
Wed Jan 4 16:45:21 PST 2012


I think I would prefer a simpler per-file approach. In light of having to do something like this again for ECMAScript.next.next how about the following?

First line:
- "use strict"; //  before ES5: ignore; ES5: ES5.strict
- use es6; // ES6: ES6
- module <ident>? { is a synonym for use es6;

With JS language versions being such a prominent issue on the web, I wouldn’t mind seeing at first glance what kind of code I am looking at.

My idea might be completely off, but whatever the final solution, it should be dead-simple to explain.

On Jan 5, 2012, at 0:56 , Mark S. Miller wrote:

> (BTW I still think we want a real |use strict;| pragma, to choke old implementations.)
> 
> Yes. Crock suggested this in the old ES5 days and I think it is still a good idea:
> 
>     "use strict"; // still runs on old browsers, but non-strictly
> 
>     use strict;  // causes an early error on old browsers.
> 
> Had we adopting it into ES5, it would have this meaning clearly. It may still be a good idea, but consider the new complexity. Now the second form also causes an early error on old ES5 browsers, where the script might otherwise have been able to run strictly.
> 

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120105/3cecee99/attachment.html>


More information about the es-discuss mailing list