No more modes?

Brendan Eich brendan at mozilla.com
Thu Oct 14 10:28:33 PDT 2010


On Oct 14, 2010, at 10:14 AM, Brendan Eich wrote:

>> I will address the more general "more modes" and compatibility direction questions for later messages.
> 
> Please, let's get to this. Otherwise more-modular arguments about "use harmony" (which is still a mode, I note!)

One more observation on the modular argument:

"use strict"; as a string ignored by downrev browsers would be unproblematic if strict mode only introduced errors, not runtime semantic changes. But ES5 strict mode also changes the semantics of eval and arguments objects.

This requires double testing: old and new (ES5-conformant) browsers running the "use strict"; code, with best test coverage. Otherwise you could test only in the new browser and instead of simply finding "lint-like" problems made errors in ES5 strict mode, you'd get different behavior from what the same code gets in old browsers.

Adding "use harmony" adds "one more mode", but with Harmony changing semantics as well as adding syntax, this raises the testing burden. Now you might have 4 combinations to test, although since we base Harmony on ES5 strict, it's more like three: old pre-ES5 browsers, ES5 browsers, Harmony browsers.

I'm not arguing that this is good or bad. ES5 strict is a done deal; the spec is going to ISO now. And my opinion is that an opt-in Harmony mode or version selection mechanism of some kind is necessary.

I am arguing that we have at least "one more mode", and we need to engineer it either to fail hard on new browsers and work compatibly on old, or else be version-selelcted out by old browsers using some kind of fallback mechanism, even if scripted -- even if

<script>
  if (this.__MAX_ECMASCRIPT_VERSION__ < 6)
    document.write("<script src='downrev.js'><\/script>");
  else
    document.write("<script src='uprev.js' type='application/ecmascript;version=6'>");
</script>

This is not the best we can do but it is better than user-agent sniffing. And user-agent sniffing is what you'll get if you don't provide some better way.

/be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20101014/39412cdf/attachment.html>


More information about the es-discuss mailing list