- 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>
>-----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