Re: How to correctly spec sequences requiring an iterable

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