Type Checking?
Garrett Smith
dhtmlkitchen at gmail.com
Thu Oct 11 13:36:46 PDT 2007
On 10/10/07, Brendan Eich <brendan at mozilla.org> wrote:
> On Oct 10, 2007, at 3:53 PM, Garrett Smith wrote:
>
> if (it is Callable) ...
>
>
> The |is| operator tests universal or Platonic type, which involves
> shared, immutable type descriptors that do not vary across windows or
> frames. So
>
> if (a is Array) ...
>
> will work no matter where a was constructed.
>
I wonder how host objects will deal with this.
Will there be a transitive relationship of callable and ()?
If an object accepts arguments, it is callable, and if it is callable,
it supports ,call(), right?
typeof appendChild; // "object"
appendChild is Callable; // ???
In IE, appendChild.call is undefined, yet accepts arguments. It's like
a host function that's bound, internally, to its node. Its thisArg is
always the node; execution context is irrelevant. It's an odd duck.
document.all(), document.links(0) are also non-functional, but "do
something" when you use arguments (). That something is not [[call]].
Opera mimicked this odd behavior with document.all and Mozilla did too
in BackCompat mode.
Hosts that create such objects create a deceptive and confusing
interface. It's like "what the heck is this thing?"
Garrett
> /be
>
>
--
Programming is a collaborative art.
More information about the Es4-discuss
mailing list