Florian Loitsch wrote:
[snip]
===
function g(arguments) {
alert(arguments.length);
}
g({length:"object"}); // "object"? or 1?
===
and in this case Konqueror, Rhino as well as Mozilla return
"object" (what I expect it to be, eventhough I'm not completely
sure, if it is defined in the spec).
The specification implies the order in section 10.1.6 - Activation Object:
"When control enters an execution context for function code, an
object called the activation object is created and associated
with the execution context. The activation object is initialised
with a property with name arguments and attributes
{ DontDelete }. The initial value of this property is the
arguments object described below.
The activation object is then used as the variable object for
the purposes of variable instantiation."
The activation object is initialised with the arguments property,
after which the same object is used for variable instantiation. As the
arguments property does not possess the ReadOnly attribute, it is safe
to assume that any local variable that is instantiated with the same
name should overwrite the arguments object. Also notice the use of the
phrase "initial value", which implies that the arguments property can
take on another value.
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.