Draft of Function.prototype.bind.

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Mon Nov 3 20:18:19 PST 2008


Maciej Stachowiak wrote:
> On Nov 3, 2008, at 11:32 AM, David-Sarah Hopwood wrote:
>> Mark S. Miller wrote:
>>> First, I'd like to thank Richard Cornford, cc'ed, who provided the
>>> earlier draft of Function.prototype.bind that grew into this one.
>>> Thanks!
>>>
>>> Below, I modified Richard's draft according to our agreements in
>>> Redmond. But I'm not happy with its complexity. If we instead specify
>>> that we test in step 3 whether the [[Class]] of G is "Function", the
>>> rest of bind() becomes much easier to specify. Should we? The only
>>> functionality lost is the ability to use bind() as a generic applied
>>> to callable non-functions. Do we care whether the built-in bind() can
>>> handle these?
>>
>> We should consider simply outlawing callable nonfunctions in ES3.1.
> 
> Why is it important that callability be tied to a specific value of the
> [[Class]] internal property?

Specification complexity. There are quite a few places in the spec that
could be simplified if only functions were callable; not just
Function.prototype.bind. For example, 'IsCallable' could be removed
entirely.

-- 
David-Sarah Hopwood



More information about the Es-discuss mailing list