On Dec 15, 2009, at 11:18 AM, David-Sarah Hopwood wrote:
Brendan Eich wrote:
In ES specs and real implementations, internal methods and various
corresponding implementation hooks are called based on [[Class]] of
the
directly referenced object, in contrast.
In ES specs, there's no indication that [[Class]] can or should be
used
for internal method lookup; I don't know where you got that idea.
Sorry, I wrote "called" where I meant "defined".
In the ES specs, [[Class]] and internal methods are matched in
invariant fashion, and the spec counts on this. ES1-3 throw TypeError
from certain built-in methods if the |this| parameter's [[Class]] is
not "RegExp", e.g. ES5 Array.isArray of course checks [[Class]]
directly.
ES doesn't use [[Class]] much other than for TypeErrors and
Object.prototype.toString, but it's aligned with the internal methods
intentionally. This was a topic in ES1 days, based on C++ and C
implementations.
As for implementation, [[Class]] could be derived from some other
type tag
that gives sufficient information to do such lookup, but [[Class]] by
itself is not sufficient.
I'm not sure what you mean. Sure, [[Class]] in the spec is string-
valued, so it can't be a vtable pointer. But in implementations that
use C++, there is not only a class name-string associated with every
instance, but a suite of internal methods or hooks.
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss