On Sun, Oct 23, 2011 at 11:11 AM, Axel Rauschmayer <[email protected]> wrote:

>
> - instanceof: use for objects.
>>
>
> It's *usable* on objects, but not all that *useful*, even with natives
> like Array (they could have come from another frame). This is my biggest
> problem with javascript's nominative types. Ducktyping helps, but meh. This
> is one reason I'm so excited about private names and the de jure namespace
> the module system gives us -- which can help sort this out once and for all.
>
>
> Both are indeed welcome. I wonder how often the frame crossing is an issue
> in practice.
>

If you control all of the code and like a constrained style, use instanceof.
For robust code use instanceof only for RHS in the same library.  Every time
I write 'instanceof' I flinch from past surprises, cross frame, objects that
should say true but don't (structurally true), objects that should say false
but don't (monkey patched).

jjb
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to