Function apply and call (was RE: Bait taken: Arguments about arguments)

Brendan Eich brendan at mozilla.com
Thu Jan 15 18:49:48 PST 2009


On Jan 15, 2009, at 5:42 PM, David-Sarah Hopwood wrote:

> Allen Wirfs-Brock wrote:
>> I generally agree that it would be a good idea to specify apply  
>> (and call)
>> pretty much as proposed below by David-Sarah. The major reason that  
>> it
>> makes it explicit what happens for most currently unspecified edge  
>> cases
>> such as a sparse argArray or argArray properties that are accessors.
>
> Exactly: even if the second argument to 'apply' were restricted to  
> Array
> and arguments objects, the properties can (and would in the case of an
> arguments object specified as in the current draft) have getters.
> So an implementation *must* read the properties in a way that has the
> full generality of [[Get]], and might as well be specified using  
> [[Get]].

This is a fix indeed.


>> I think putting in the argument number limit check is starting down
>> a slippery slope. There are many things in the spec. (number of  
>> locals,
>> size of numbers, size of methods, etc.) that might plausibly have an
>> implementation limit. I don't think we can reasonably identify all of
>> them and I don't think this one is special enough to make it an  
>> exception.
>
> The issue here is that typical implementations do have a rather small
> limit on number of arguments. If the spec doesn't acknowledge this,
> then those implementations are clearly violating the spec.

SpiderMonkey functions may have at most 65535 parameters. This is not  
"rather small" so I'm curious what typical implementations you mean.


> Size of numbers is not implementation-defined; it's precisely  
> specified.

The bound on integer fitting in IEEE-754 double is insanely high  
compared to any reasonable bound on maximum number of parameters.


> I think there are fewer reasonably allowable implementation limits  
> (that
> should not be treated as implementation bugs) than you suggest. They  
> can
> and should all be explicitly pointed out by the spec -- but I'm  
> quite happy
> for that to be treated as a separate issue.

Open a ticket and list your minimum set of allowable limits?

/be



More information about the Es-discuss mailing list