Draft of Function.prototype.bind.

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Mon Nov 10 19:25:39 PST 2008


David-Sarah Hopwood wrote:
> Waldemar Horwat wrote:
>> Mark S. Miller wrote:
> [Kona 15.3.4.5]
>>>         11. If the [[Class]] property of /G/ is *"Function"*, then
>>>                1. Get the *length* property of /G/.
>>>                2. Let /L/ be Result(11a) minus the length of /A/.
> 
> [These substeps are actually labelled a. and b.]
> 
>> What does "minus" mean here?  Result(11a) could be anything.
> 
> The 'length' property of a built-in object with [[Class]] "Function"
> is not Writable or Configurable [Kona 15.3.5.1], so it must be equal
> to the number it was set to in either [Kona 13.2 step 7] or
> [Kona 15.3.4.5 step 11c or 12], which are the only places where
> built-in objects of [[Class]] "Function" are created (and [[Class]]
> cannot be changed after creation).

Also the value set in [Kona 13.2 step 7] or [Kona 15.3.4.5 step 11c or 12]
is in the range 0..(maximum number of function arguments).


However, I cannot find anything in the spec that allows an implementation
to fail to support an unbounded number of arguments to a function. This
is a bug, probably in section 10.1.3. There are other similar bugs, for
example the length of array literals may be unbounded.

In general, there is no permission to fail when the spec requires computing
a number that is not representable as a value of Number type, or when the
implementation runs out of memory, or reaches a maximum stack depth or
other implementation limit. This should be fixed in ES3.1 (note that all
of the secure subsets would like to be able to trap such failures and shut
down the entire context, as opposed to throwing an exception).

-- 
David-Sarah Hopwood


More information about the Es-discuss mailing list