W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2015

Re: Array-with-item in WebIDL

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Wed, 10 Jun 2015 17:19:29 -0700
Cc: Jonas Sicking <jonas@sicking.cc>
Message-Id: <57973DC5-BF6E-46EB-A116-312FDDFEB17B@wirfs-brock.com>
To: public-script-coord <public-script-coord@w3.org>

On Jun 9, 2015, at 9:45 PM, Jonas Sicking wrote:

> ...
> The only thing preventing us from doing this is that the DOM classes
> for historical reasons have a .item() function on them. This .item()
> function is redundant and most developers simply use domObject[n]
> rather than domObject.item(n). Sadly the .item() functions seem used
> enough that switching to Arrays isn't web compatible.
> I was thinking we could introduce a sequence_with_item<...> type in
> WebIDL. This would simply map to a real Array object, but one which
> has a .item function added to it. Either by adding a .item function on
> the returned object itself, or by making the return object have a
> different prototype, but otherwise be a normal Array.
> Obviously an alternative is to just leave things as status-quo.
> / Jonas

It would seem straight forward to definesequence_with_item<...> as essentially an ES6 subclass of Array that adds an `item` method.  It would inherit all of the Array methods and semantics

Received on Thursday, 11 June 2015 00:19:58 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:24 UTC