On Jan 15, 2010, at 5:49 PM, Mike Samuel wrote:
2010/1/15 Brendan Eich <[email protected]>:
On Jan 14, 2010, at 6:27 PM, Mike Samuel wrote:
Any thoughts on whether (eval(a, b)) should be an invocation of the
eval operator?
What do current browsers do? It's an eval operator in Mozilla-based
browsers. Seems to be eval (dynamic scope, not global scope) in
Safari too.
What would be the benefit of changing a future edition to make such
an eval
"indirect"?
I am not advocating changing eval in a future edition.
What I found confusing was that the previous section started with
"When the eval function is called with one argument x, the
following steps are taken:"
and whether that was assumed by the following section.
But somebody here read 15.1.2.1 and concluded that eval with other
than one argument was the function.
I concluded otherwise. I still don't know what the answer is?
"15.1.2.1.1 Direct Call to Eval" does not care about number of actual
arguments, only about the 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."
So ES5 says eval(s, x) is a direct call.
"When the eval function is called with one argument x, the following
steps are taken" is misworded -- it wants to introduce the
metavariable x but it overspecifies for the case of exactly one
argument. In fact eval() returns undefined per the specified
semantics, and so does eval(undefined, {}). And at least Firefox and
Safari eval(s, {}) where s is a string as a direct eval call.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss