Should host objects be able to have [[Class]] "Function", "Array" etc.?
david.hopwood at industrial-designers.co.uk
Thu Nov 20 00:24:50 PST 2008
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.
>>> 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.
> At least by the definitions of Host object, Native object and Built-in
> object, any object "supplied by the host environment" rather than "
> supplied by an ECMAScript implementation, independent of the host
> environment" is a Host object.
You're misreading this. Any object provided by a host API (such as the
DOM in browsers) can be a native object. It would be ridiculous not to
allow that: what advantage would there be in prohibiting a DOM
implementation or other API from being written partly in ECMAScript,
or behaving *exactly* as if it were partly written in ECMAScript?
More information about the Es-discuss