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

Re: sequence and iterables

From: Jonas Sicking <jonas@sicking.cc>
Date: Fri, 15 Nov 2013 18:17:56 -0800
Message-ID: <CA+c2ei_pW9oyUKzneVc2TqrhCkj7=Cz=zSTYh9RgiYLq6iPD-Q@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>, Anne van Kesteren <annevk@annevk.nl>
On Fri, Nov 15, 2013 at 6:13 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> I'm no longer entirely convinced that sequence should necessarily map to
> iterables.
> In particular, sequence as currently specced would correspond to
> snapshotting the iterable immediately, but that's an odd thing to do with an
> iterable.  A more natural representation of iterables might be some sort of
> iterator object, though then you have to be very careful about it throwing
> exceptions, etc...

Can you give an example of when this is a problem. Snapshotting an
iterable to me simply means iterating the iterator all the way through
and remembering the data that it returned.

This is generally something that we want to do synchronously from the
API before returning. Otherwise we need to defined exactly when the
iterator is read. I can't think of any existing APIs that deal with
array-like things and that doesn't iterate through the whole
array-like before returning.

/ Jonas
Received on Saturday, 16 November 2013 02:18:54 UTC

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