Bait taken: Arguments about arguments
erik.arvidsson at gmail.com
Thu Jan 15 09:50:31 PST 2009
Sorry for being late to the party.
Is there a reason why we need to restrict the argArray to apply this
much? I think it would be very useful to allow anything array like
2009/1/15 Brendan Eich <brendan at mozilla.com>:
> On Jan 14, 2009, at 9:16 PM, Mark S. Miller wrote:
> On Wed, Jan 14, 2009 at 7:08 PM, Brendan Eich <brendan at mozilla.com> wrote:
>> When in doubt, use brute force. ES3 already did. Quoting from its spec for Function.prototype.apply:
>> 18.104.22.168 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, argArray, …, 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.
> Es3.x-discuss mailing list
> Es3.x-discuss at mozilla.org
More information about the Es-discuss