Re: Non-constructible constructors and Arrays

On 7/31/11, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 7/31/11 7:50 PM, Cameron McCormack wrote:
>> Here is a proposal (which I haven't thought deeply about yet): any
>> interface that supports indexed properties and which does not inherit
>> from another interface
>
> As things stand this would include Window (but not HTMLFormElement,
> since that inherits from HTMLElement, right?).
>
> I suspect that having Window inherit from Array.prototype would probably
> not be web-compatible, but I'm willing to be proved wrong...
>
Since window is effectively global, you'd end up with global array
properties on every website, e.g. global `filter`, `sort`, etc. That
might be a problem.

There's also existing web code that uses `x instanceof Array`, which
might be a problem if the code makes subsequent calls to mutable Array
operations like `x.splice`.
-- 
Garrett

Received on Monday, 1 August 2011 00:12:21 UTC