Future proof "use strict";

Michael Schurter michael at susens-schurter.com
Fri May 22 14:54:53 PDT 2009


I'm just a lowly Python/JS webdev eager to use ES5.  John Resig
encouraged me[1] to post this suggestion, so blame him if its no
good.  ;-)

For the record: my 2 original comments on "use strict" [2] [3]

Essentially my fear is that the meaning of "use strict" becomes
ambiguous when future versions of ECMAScript are released (6 and
beyond).

What seems reasonable for both ES users (webdevs) and implementors is
for ES engines to support only 2 modes: strict and permissible,
supporting fine-grained per-ES-version language support would cause
undue complexity for implementors.

However, when ES users enable the strict mode, they have a specific ES
version in mind (right now 5, but in the future perhaps 6, 5.1, etc).

Based on the 2 reasonable modes model I describe above "strict ES v5"
should be evaluated in the *permissible* mode by future ES versions.

Therefore, ES users need a way to define an ES *version* to target.
This could be as simple as:  "use strict 5"; which could even be used
alongside the current "use strict"; right now.

A more robust model might be to allow the mode to be defined in a
conditional statement:

if (ecmascript.version <= 5) "use strict";

As a side note, it would be nice if some sort of strictness stability
were to be guaranteed like API/ABI stability within major ES versions.
So that ES 5.1 strict == ES 5 strict != ES 6 strict.

Like I said, I could be way off base here.  I'm joining the discussion a
bit late and only from the perspective of an ES user.  :-)

Michael Schurter
schmichael on IRC, Twitter, etc

[1]
http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/#comment-385042
[2]
http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/#comment-384967
[3]
http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/#comment-385019
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090522/5f55108d/attachment.bin>


More information about the es-discuss mailing list