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

Re: How to correctly spec sequences requiring an iterable

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Thu, 11 Sep 2014 22:03:50 -0400
Message-ID: <54125486.3010003@mit.edu>
To: public-script-coord@w3.org
On 11/18/13, 12:59 PM, Boris Zbarsky wrote:
> My current plan in WebIDL is to spec sequence<> as follows, with the
> incoming value as "val":
>
> 1) If val is not an object, move on to the next union member (or throw
>     an exception if none left).  This allows a union of sequence and
>     string, and is the current behavior of sequences anyway.
> 2) Do iter = Get(val, @@iterator).  ReturnIfAbrupt.
> 3) If the value is not an object or is not callable, move on to the
>     next union member.
> 4) Commit to treating this as a sequence.
> 5) iterator = iter.call(val);
> 6) Walk through with IteratorStep/IteratorValue etc, converting each
>     sequence element before stepping to the next one.

Following up on this: per more recent discussion, I'm going to make this 
more like Array.from instead. So replace step 3 with "If the value is 
undefined, move on to the next union member".

-Boris
Received on Friday, 12 September 2014 02:04:16 UTC

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