"Harmony is a super-set of ES5 strict"

David Herman dherman at mozilla.com
Thu Mar 3 18:55:50 PST 2011

On Mar 3, 2011, at 5:33 PM, Waldemar Horwat wrote:

> If we're saying that Harmony is strict-only, settable by a <script> tag, what will indirect eval and the Function constructor do if the evaluated code doesn't start with a "use strict" directive?

Yeah, "strict-only" is probably not quite the right way to describe it. We discussed this a bit at the last face-to-face. Generally, Harmony still has to allow for the existence of non-Harmony code living and executing in the same heap. For example, a web page can contain

    <script type="application/javascript">...</script>
    <script type="application/javascript?version=HARMONY">...</script>

and the bindings of both can see each other. If I remember right, the semantics we've talked about is that indirect eval defaults to ES5 non-strict. So the answer to your question is: the indirect-eval'ed code is non-strict.

So I think it might be a little misleading to say Harmony is strict-only. It's a little more accurate to say that by default, Harmony code assumes the restrictions of ES5 strict mode and builds from there. However, it is possible to access and evaluate non-strict code via indirect eval, or -- in the browser setting, for example -- via access to code defined in non-Harmony.


More information about the es-discuss mailing list