On Feb 27, 2009, at 11:59 PM, Mark S. Miller wrote:
In the 23feb09 draft, arguments objects have a [[Class]] of "Object" and inherit their toString property from Array.prototype. Array.prototype.toString in effect simply does "return this.join();". However, Array.prototype.toString is not generic (it insists that its this have [[Class]] "Array") even though Array.prototype.join() is generic. Altogether, by the 23feb09 draft, attempting to print an arguments object must result in a throw. I doubt this is what anyone intends. Could we simply make Array.prototype.toString generic, so that the it works when inherited?
Compatibility means returning "[object Object]" from (function f() {return arguments;})().toString(). At least for browsers other than Safari. I don't know of any web content that counts on this, but I haven't looked and it's a big web ;-).
Btw, I notice on Safari that the [[Class]] of an arguments object is "Arguments". Given how weird the arguments object is, if it is not too late, I think Safari's special [[Class]] value would be a good idea.
That's a better idea than what ES1-3 say, for sure. I wonder whether that goes back to the kjs dawn of time. Cc'ing Maciej.
We could try this out during implementation of 3.1, before finalizing the standard. Is it better than making the delegated Array.prototype.toString generic, though?
/be _______________________________________________ Es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

