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

David-Sarah Hopwood david.hopwood at
Fri Nov 14 16:48:19 PST 2008

David-Sarah Hopwood wrote:
> Waldemar Horwat wrote:
>> Mark S. Miller wrote:
> [Kona]
>>>         11. If the [[Class]] property of /G/ is *"Function"*, then
>>>                1. Get the *length* property of /G/.
>>>                2. Let /L/ be Result(11a) minus the length of /A/.
> [These substeps are actually labelled a. and b.]
>> What does "minus" mean here?  Result(11a) could be anything.
> The 'length' property of a built-in object with [[Class]] "Function"
> is not Writable or Configurable [Kona], so it must be equal
> to the number it was set to in either [Kona 13.2 step 7] or
> [Kona step 11c or 12], which are the only places where
> built-in objects of [[Class]] "Function" are created (and [[Class]]
> cannot be changed after creation). But that should be explained in a
> NOTE section.
> Caveat:
> [section 15]
> # The value of the [[Class]] property of a host object may be any value,
> # even a value used by a built-in object for its [[Class]] property.
> So any random host object might have [[Class]] "Function" (which is a
> bug). If that is the case, all bets are off (and in that case steps 11
> and 15 of the 'bind' algorithm are broken anyway -- for example, the
> 'length' or 'prototype' properties of G might not exist).

We didn't resolve this.

Should host objects be required not to have [[Class]] "Function"?

Should host objects be required not to have [[Class]] "Array",
"Boolean", "Date", "Decimal", "JSON", "Math", "Number", "RegExp",
or "String"?

(I have not included "Error" on this list because it is reasonable
for an implementation to add new error types, which would be host
objects because they are not described in the standard. All
existing error types have [[Class]] "Error". Unlike the other
classes, this appears to cause no harm because the standard never
tests whether an object has [[Class]] "Error".)

Note that Function objects, Array objects, etc. are by definition
not host objects.

> Incidentally, the following sentence in section 15:
> # Unless specified otherwise, the [[Class]] property of a built-in
> # object is "Function" if that built-in object has a [[Call]]
> # property [...]
> is misleading because:
> # The value of the [[Class]] property is defined by this specification
> # for every kind of built-in object.
> i.e. there is no default for [[Class]] in the case of built-in objects.
> That is what allowed me to make the above assertions for built-in
> objects, otherwise I'd have had to read the entire spec rather than
> just searching for "Function". The sentence that implies that there
> are defaults for [[Class]] should be removed.

David-Sarah Hopwood

More information about the Es-discuss mailing list