Open DartBot opened 10 years ago
Added Area-Documentation, Docs-API, Library-Async, Triaged labels.
What would the alternative be? Reading all the elements of the iterable first and then starting to emit events?
Changed the title to: "Stream.fromIterable: document lazy iteration".
Removed Area-Documentation label. Added Area-Library, Type-Documentation labels.
This comment was originally written by @seaneagan
Yes, that would be the alternative. The implemented behavior is obviously better, but since lazy iteration is not documented, I assumed the simplest impl that came to mind, which was eager iteration. The lazy (async) iteration could lead to ConcurrentModificationErrors, so I would almost be tempted to warn about that.
Also, the laziness of Iterable.map/where/etc. is explicitly documented.
This issue was originally filed by @seaneagan
Stream.fromIterable waits for the event from the previous iterable element to be emitted, before further advancing the iterator. This should be documented.