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

Maciej Stachowiak mjs at apple.com
Thu Nov 20 01:43:11 PST 2008


On Nov 20, 2008, at 1:39 AM, David-Sarah Hopwood wrote:

> Maciej Stachowiak wrote:
>> On Nov 20, 2008, at 12:24 AM, David-Sarah Hopwood wrote:
>>> Maciej Stachowiak wrote:
>>>> On Nov 19, 2008, at 11:37 PM, David-Sarah Hopwood wrote:
>>>>> 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)
>>>
>>> There's no such thing as an "internal function", in ECMA-262 terms.
>>> You presumably meant "callable host objects" here.
>>
>> No. See "10.1.1 Function Objects" in ECMA-262 3rd edition.
>
> Yes, I corrected this in a follow-up. But internal functions by that
> definition are native Function objects, so they are not relevant to
> the argument about host objects. They only differ from non-internal
> Function objects by having a [[Call]] method that executes non- 
> ECMAScript
> code, and by being excluded from the discussion of Execution  
> Contexts in
> chapter 10.

If all non-ECMAScript-coded methods in the DOM, or other add-on  
interfaces, can be Native internal functions rather than Host objects,  
even if they have behavior that does not match any predefined native  
Function, then I am not sure what a requirement for Host objects not  
to have [[Class]] "Function" would achieve.

Regards,
Maciej



More information about the Es-discuss mailing list