Fixing instanceof (Array.isArray() etc.)?

Axel Rauschmayer axel at rauschma.de
Sat Jan 21 22:13:53 PST 2012


Duck typing is an interesting consideration. If one could express

     x follows ArraySpec

then that would work for both array-like objects and Array instances from other frames.

On Jan 20, 2012, at 19:28 , Herby Vojčík wrote:

> Inspired by Smalltalk messages like #isInteger (defined in Object as returning false, defined in Integer as returning true) one possible solution would be to use variation of it. Its problem (or advantage, as one sees at it) is that it is designed for overwriting and possibility have forest, not only tree of objects that return isXxx as true; the is, for duck-typing.


--
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120122/9dc82de5/attachment.html>


More information about the es-discuss mailing list