[[Class]] and host objects
brendan at mozilla.com
Fri Feb 6 17:20:31 PST 2009
On Feb 6, 2009, at 5:01 PM, Allen Wirfs-Brock wrote:
> I assume that we wanted to allow under some circumstances for host
> objects to have a [[Class]] value that is the same as one of the
> built-in values (“Object” comes to mind ).
Note that the arguments objects must seem to have [[Class]] ==
"Object" (the Object.prototype.toString.call(arguments) test).
> But what does that really mean. Which “requirements” are we talking
> about? That the host object must fully implement the Section 15
> specification of the corresponding built-in object? In that case,
> isn’t such a host object really just a way to implement the native
> object. In other words, it’s actually a native object not a host
> object at all? In that case we probably also don’t need to say
Think tiered virtual machines where for N > 1, tier N's Object is tier
N-1's host emulation with [[Class]] == "Object" but extra hooks and
metamagic, backstage of tier N's reality.
How can tier N tell? It can't. But the only truly "native"
implementation of Object would be tier 1's.
I shall avoid getting into Descarte, Baudrillard, or "The Matrix",
> Is it really the intent that any object whose [[Class]] is “Array”
> must fully implement 15.4.5? One of the things that 15.4.5 says is
> that array instances inherit from the original Array prototype
> object. Is this a requirement of [[Class]]==”Array”? If so, what
> about array objects that come from different contexts that have a
> different Array prototype object?
The spec going back to ES1 has pretty much failed to deal with
multiple global objects. We talked about this at the meeting, and IIRC
you were inclined to try an informative TR or Annex. :-)
> Is the requirement really only that “Array” objects implement the
> special [[ThrowingPut]] method defined in 22.214.171.124.
No, there has to be more to it than that.
> I’ve tried various formulation of a simple statement about host
> objects but I keep finding potential holes and coming back to the
> conclusion that the only meaningful thing to do is to explicitly
> enumerable the invariants associated with each predefined [[Class]]
> value. Does anybody have a simpler solution? Does anybody want to
> volunteer to identify the invariants?
I think Chapter 15 already does identify the invariants, but you're
right that multiple globals are not specified. In a single-global
embedding, I would want any host [[Class]] == "Array" impostor to
create instances whose prototype was Array.prototype, though. Wouldn't
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Es-discuss