Draft of Function.prototype.bind.

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


Mike Shaver wrote:
> On Mon, Nov 3, 2008 at 12:32 PM, David-Sarah Hopwood
> <david.hopwood at industrial-designers.co.uk> wrote:
>> An object that was previously a callable nonfunction in some browser,
>> can always be compatibly changed into a real function instead.
> 
> Does that mean that RegExp.prototype has as its prototype
> Function.prototype, for those implementations which have callable
> RegExps?

It's not clear to me that it is conformant to ES3 for RegExp objects
to be callable. The behaviour of internal methods for native objects
is fully defined by the spec; it's only host objects for which an
implementation has latitude to define additional internal methods:

Section 8.6.2
# The following table summarises the internal properties used by this
# specification. The description indicates their behaviour for native
# ECMAScript objects. Host objects may implement these internal methods
# with any implementation-dependent behaviour, or it may be that a host
# object implements only some internal methods and not others.
[...]
# [[Call]] |
# a list of argument values provided by the caller |
# Executes code associated with the object. Invoked via a function
# call expression. Objects that implement this internal method are
# called /functions/.

That is, native objects that implement [[Call]] must be functions.

-- 
David-Sarah Hopwood


More information about the Es-discuss mailing list