Type Checking?
Brendan Eich
brendan at mozilla.org
Wed Oct 10 17:42:14 PDT 2007
On Oct 10, 2007, at 3:53 PM, Garrett Smith wrote:
> Typechecking is a problem.
>
> typeof is limited and allows host objects to return anything. The
> problem is that some host objects return "function", for example, a
> NodeList in Safari. This is perfectly legal, according to the spec.
See http://bugs.ecmascript.org/ticket/153 -- for a general, universal
is-it-callable test, you would write
if (it is Callable) ...
> How is type checking addressed in ES4?
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.
/be
More information about the Es4-discuss
mailing list