W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2009

RE: Strategies for standardizing mistakes

From: Allen Wirfs-Brock <Allen.Wirfs-Brock@microsoft.com>
Date: Thu, 15 Oct 2009 17:47:37 +0000
To: Jim Blandy <jimb@mozilla.com>, Maciej Stachowiak <mjs@apple.com>
CC: "Mark S. Miller" <erights@google.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Simon Pieters <simonp@opera.com>, "es-discuss Steen" <es-discuss@mozilla.org>
Message-ID: <90EDC335A511F2479C63F7337D3CE7DB703C39@TK5EX14MBXC116.redmond.corp.microsoft.com>
>-----Original Message-----
>From: es-discuss-bounces@mozilla.org [mailto:es-discuss-
>bounces@mozilla.org] On Behalf Of Jim Blandy
...
>
>In the case of 'eval', ES5 requires an implementation to inspect the
>context of the call.  A direct call to eval runs the code in the call's
>environment; indirect calls run in the global environment.  This makes
>eval into a pseudo-syntactic form: really, expressions of the form
>'eval(...)' are special to the compiler, regardless of eval's binding.
>

Correct, "indirect eval" is a normal function call while  direct eval is essentially a syntactic form and need not actually call the global eval function.  This was done to avoid any implication that the global eval function would need to have a mechanism for inspecting its calling context.

>The way Mozilla treats 'document.all' seems analogous.
>

Is the Mozilla document.all optimization contingent upon the occurrence of the text "document.all"?  What happens for:
   var docAll = document.all;
   if (docAll) alert("IE"); else alert("not IE");

It's the use of the literal name "eval" that make direct eval a pseudo-syntactic form.

Allen 
Received on Thursday, 15 October 2009 17:48:16 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:02 UTC