On Oct 14, 2010, at 9:21 AM, Mark S. Miller wrote:

> I can we why it seems that I was implying that, but I'm making more modular 
> arguments than that.

I appreciate modular arguments and expect no less from you :-). But however 
modular, the bigger issues I keep harping on remain. Still, this is a good 
separate topic so I'll add something.


> This issue *by itself* suggests that a harmony opt-in should be managed by a 
> prologue / pragma at the beginning of a Program production[1], rather than an 
> attribute on a script tag, so it can follow the same opt-in logic as "use 
> strict" and apply to eval code as well.

Maybe, but ES5 direct eval from strict code uses strict mode in the eval'ed 
program. No directive or pragma in that eval'ed program's source string (passed 
as the direct eval's argument) is needed.

So the directive may be a good idea (more below), but it is not necessary by 
the design of ES5 strict mode and direct eval. The same seems to apply to 
Harmony opt-in.


> Thus,
> 
>     e2(' "use harmony"; var module = 1');
> 
> could be illegal on browsers supporting harmony. And such evaled code would 
> also not have the global object at the bottom of their scope chain. This 
> in-language switch makes more sense to me than a markup-based switch such as 
> <script ...>, and would allow the switch to be recognized in non-browser 
> environments such as commonjs.

The problem remains syntax errors in top-level script. Developers are generally 
not going to write Harmony script if the only way to load it is via XHR, or 
else to encode it with escapes and so on in string literals fed to eval.

It's not an "either/or", though: script versioning a la RFC4329 and a "use 
harmony" pragma could both be worth having.

But if you only have "use harmony", then you cannot use it in script tags 
without inevitable syntax errors in old browsers on the new syntax that follows 
the pragma. This means you have to eval, and this is both onerous for 
developers and expensive (and different from script-loading) at runtime.


> 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!) do not help resolve the crucial issues: 
fallback content selection for old browsers.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to