On Jan 14, 2009, at 9:16 PM, Mark S. Miller wrote:

On Wed, Jan 14, 2009 at 7:08 PM, Brendan Eich <[email protected]> wrote:

When in doubt, use brute force. ES3 already did. Quoting from its spec for Function.prototype.apply:

15.3.4.3 Function.prototype.apply (thisArg, argArray)
[...] Otherwise, if argArray is neither an array nor an arguments object (see section 10.1.8), a TypeError exception is thrown. If argArray is either an array or an arguments object, the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1], …, argArray[ToUint32(argArray.length)–1]. [...]

Yes, this is the spec text I quoted as well. But I don't understand it or your "use brute force" answer.

Sorry, didn't mean to rehash.


How does Function.prototype.apply determine that argArray is an arguments object?

ES1-3 leave this unspecified. But they talk about "an arguments object [being] created" (10.1.8), etc. and it's easy enough to implement the spec -- there are many implementations. SpiderMonkey uses a distinct class whose name is "Object", to satisfy what is specified ([[Prototype]] is the original Object.prototype value). Do we need really need to say more?


We need to do something, since as it stands the operational spec is unimplementable in terms of the specified semantic state.


The spec has a domain of discourse that includes "an arguments object". It's implementable without error. Sure, we could add another internal property to avoid this appeal to an unspecified way of distinguish arguments objects from all other objects. Again I'm loath to over-invest.

/be
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to