W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

Re: Non-constructible constructors and Arrays

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Sun, 31 Jul 2011 17:11:54 -0700
Message-ID: <CABZUbM2gN7oER7oqcdq6xFep9w_iX_RPHKER7L9gUyk7-F8DWQ@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: public-script-coord@w3.org
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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC