W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2012

Re: Support for iterators

From: David Bruant <bruant.d@gmail.com>
Date: Wed, 07 Nov 2012 08:41:48 +0100
Message-ID: <509A10BC.2070605@gmail.com>
To: Allen Wirfs-Brock <allen@wirfs-brock.com>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
Le 07/11/2012 02:36, Allen Wirfs-Brock a écrit :
> On Nov 6, 2012, at 11:35 AM, David Bruant wrote:
>> Hi,
>> The WebAPI team at Mozilla defined the DeviceStorageAPI [1] which contains the following:
>> interface DeviceStorage {
>>   /* ... */
>> // See interface below for how to use this
>> DeviceStorageCursor enumerate(optional DOMString directory)
>> DeviceStorageCursor enumerateEditable(optional DOMString directory)
>> };
>> interface DeviceStorageCursor : DOMRequest {
>> void continue();
>> };
>> It really feels like an ES6 generator [2]. Is it possible to add a new keyword that would allow people defining WebIDL interfaces to define generators so that we have consistent interfaces between ES code and web API code? For the ECMAScript binding, this keyword would obviously refer to an generator.
> A generator is mostly just a way to implement an iterator, so it is probably the iterator interface that you would want to specific, expect for rare situations where you need the extra API surface area (send, close, throw) of a generator.
> In most cases, it can probably be left to an implementation to decide whether nor not is uses a generator to implement the iterator contract.
True. I'm changing the title to "support for iterators".

Received on Wednesday, 7 November 2012 07:42:18 UTC

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