Draft of Function.prototype.bind.
david.hopwood at industrial-designers.co.uk
Mon Nov 10 18:20:52 PST 2008
Waldemar Horwat wrote:
> Mark S. Miller wrote:
>> 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 184.108.40.206], so it must be equal
to the number it was set to in either [Kona 13.2 step 7] or
[Kona 220.127.116.11 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). But that should be explained in a
# The value of the [[Class]] property of a host object may be any value,
# even a value used by a built-in object for its [[Class]] property.
So any random host object might have [[Class]] "Function" (which is a
bug). If that is the case, all bets are off (and in that case steps 11
and 15 of the 'bind' algorithm are broken anyway -- for example, the
'length' or 'prototype' properties of G might not exist).
Incidentally, the following sentence in section 15:
# Unless specified otherwise, the [[Class]] property of a built-in
# object is "Function" if that built-in object has a [[Call]]
# property [...]
is misleading because:
# The value of the [[Class]] property is defined by this specification
# for every kind of built-in object.
i.e. there is no default for [[Class]] in the case of built-in objects.
That is what allowed me to make the above assertions for built-in
objects, otherwise I'd have had to read the entire spec rather than
just searching for "Function". The sentence that implies that there
are defaults for [[Class]] should be removed.
More information about the Es-discuss