Re: Non-constructible constructors and Arrays

(Missed your reply earlier, hence responding to Jonas wondering about 
cases when we don't want Array methods on an object.)

On 1/08/11 11:56 AM, Boris Zbarsky 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...

I think that's a good enough counterexample to have to opt in or out of 
this functionality.

>> It is then incumbent on the API designer to define index
>> setters/creators/deleters
>> appropriately such that the mutating Array methods make sense.
>
> We can't really change the meaning of indexed properties on Window, imho.

Right, though I meant only if you wanted to add the mutable behaviour to 
the list.  (For Window, you wouldn't, so you would rely on push etc. 
throwing.)

Received on Tuesday, 2 August 2011 05:11:46 UTC