Strategies for standardizing mistakes

Allen Wirfs-Brock Allen.Wirfs-Brock at
Thu Oct 15 10:47:37 PDT 2009

>-----Original Message-----
>From: es-discuss-bounces at [mailto:es-discuss-
>bounces at] 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.


More information about the es-discuss mailing list