Type Checking?

Garrett Smith dhtmlkitchen at gmail.com
Wed Oct 10 18:01:36 PDT 2007


On 10/10/07, Brendan Eich <brendan at mozilla.org> wrote:
> 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.
>
Immutable type descriptor. I like it!


> /be
>
>


-- 
Programming is a collaborative art.



More information about the Es4-discuss mailing list