On Tue, Nov 20, 2012 at 2:02 PM, Rick Waldron <waldron.r...@gmail.com> wrote:
> On Tue, Nov 20, 2012 at 4:52 PM, Tab Atkins Jr. <jackalm...@gmail.com>
> wrote:
>> Of course, that pattern is broken too - it lets you detect actual
>> Arrays, but not things that subclass Array.
>
> That's not possible in JavaScript today, so it's not "broken". There is no
> way to correctly subclass Array, so this has never been an issue that
> JavaScript programs would encounter. Future hostile? Maybe.

function foo() {...}
foo.prototype = [];

You get an object which has a self-updating .length property, gets all
the Array methods like .map(), etc.  If that's not "subclassing", I
don't know what is.  ^_^

~TJ
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to