double checking if window.eval(…) is an indirect call to eval().

John-David Dalton john.david.dalton at gmail.com
Sat Aug 27 12:13:03 PDT 2011


So I have read the section (and the notes associated with it) over
what a direct call to eval is:
http://es5.github.com/#x15.1.2.1.1
http://dev.w3.org/html5/spec/Overview.html#script-s-global-object

> A direct call to the eval function is one that is expressed as a CallExpression that meets the following two conditions:
> The Reference that is the result of evaluating the MemberExpression in the CallExpression has an environment record as its base value and its reference name is "eval".
> The result of calling the abstract operation GetValue with that Reference as the argument is the standard built-in function defined in 15.1.2.1.

But I am still a little unsure if `window.eval(…)` is a direct call or not.
I have heard `window.eval()` is an indirect call but wanted to make sure.

I see it as
<call expression><member expression> window.eval</member expression>
(…) </call expression>

Wouldn't the result of evaluating the MemberExpression `window.eval`
have global's environment record as its base and a reference name of
`eval`?
Is `window.eval(..)` a direct call to eval?

Thanks,
-JDD


More information about the es-discuss mailing list