"Subclassing" basic types in DOM - best method?
waldron.rick at gmail.com
Tue Nov 20 13:59:43 PST 2012
On Tue, Nov 20, 2012 at 4:54 PM, Peter van der Zee <ecma at qfox.nl> wrote:
> On Tue, Nov 20, 2012 at 10:31 PM, Rick Waldron <waldron.rick at gmail.com>
> > On Tue, Nov 20, 2012 at 2:45 PM, Tab Atkins Jr. <jackalmage at gmail.com>
> > wrote:
> >> On Mon, Nov 19, 2012 at 9:46 PM, Brendan Eich <brendan at mozilla.com>
> >> > Tab Atkins Jr. wrote:
> >> >> If we did this, the only reason to continue subclassing Map is to get
> >> >> instanceof checks to work. Is this acceptable?
> >> >
> >> > I think it's either irrelevant (no one tests 'aUrlQuery instanceof
> >> > or else a potential problem (cross-frame instanceof).
> >> People *do* perform those checks, though. For example, in a method
> >> that accepts either an array or other things, a quick "foo instanceof
> >> Array" check is a clear, easy way to check what you've got.
> > Be careful there, it's incredibly rare to see code that does that—which
> I don't agree. I see often see instanceof, both with Array and with
> other objects. This danger you and everybody speaks of only applies to
> cross-frame scripts.
Please don't lump me in, I said: 'instanceof is generally viewed (whether
correctly or not) as "broken".' I said _nothing_ about cross-frame-anything.
> And while this danger is real (and I don't mean
> to make it sound like it isn't), I think you should first consider the
> amount of people actually doing cross frame scripting because it's not
> something most people touch frequently, if at all. Any studies to get
> such numbers?
I'm more concerned with this:  instanceof Object; // true
> - peter
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss