Re: sequence and iterables

On Fri, Nov 15, 2013 at 6:47 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 11/15/13 9:32 PM, Jonas Sicking wrote:
>> These two are only distinguishable from outside of 'f' if doStuff
>> synchronously calls back into "external code".
>
> More precisely, if doStuff has any synchronous side-effects the caller can
> detect.

Just having side effects isn't really enough, no? It needs to be also
possible for the caller to synchronously run code after the side
effects of the doStuff calls for some items have happened, but before
the side effects of other doStuff calls have happened.

For example if doStuff(n) simply adds the value 'n' to some page
accessible state, that is a side effect, but not enough of a side
effect that the page can detect iterating vs. snapshotting. Likewise
if doStuff(n) appends 'n' to some array that also isn't enough. At
least assuming that the page can't change the array such that it can
cause setters to run while the array is modified.

So you really need some form of callback as far as I can tell.

> The proposed spec for Promise.all is what prompted my mail.
>
> That said, you seem to be right; in the DOM and HTML specs as of today there
> seem to be no uses of sequence where the difference would be observable....
> So maybe I shouldn't worry about it.

I wouldn't worry about it until it happens more often.

/ Jonas

Received on Saturday, 16 November 2013 03:10:14 UTC