Should host objects be able to have [[Class]] "Function", "Array" etc.?

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Wed Nov 19 23:37:41 PST 2008


Maciej Stachowiak wrote:
> On Nov 18, 2008, at 11:00 AM, Mark S. Miller wrote:
> 
>> I also don't see a problem with David-Sarah's suggestion of forbidding
>> host objects from having [[Class]] "Function". Most places in the spec
>> care only about whether something is callable (has a [[Call]]
>> property), not whether it has [[Class]] "Function".
> 
> It seems arbitrary to me that functions implemented in native code
> ("internal functions" in ECMA-262 terms) that are part of the ECMAScript
> spec must have the [[Class]] "Function", but any that are not specified
> there (and are perhaps specified elsewhere) would be required not to
> have [[Class]] "Function".

It is perfectly possible for a function specified elsewhere to be
a native Function object (and to have whatever other methods and
properties that 'elsewhere' specifies for it). There is little reason
to define callable non-functions, since functions are flexible enough.

-- 
David-Sarah Hopwood


More information about the Es-discuss mailing list