Hello everybody and happy new year
I was thinking to RFC the following union:
typedef IterableFactory = array | IteratorAggregate;
As you know, passing Iterators around is a bad idea because one can
accidentally end up using them concurrently. For example if one entity is
traversing the iterator, and a second entity calls rewind() and fully
traverses the very same iterator, the first entity would try to continue
the traversal from a finished iterator. So in order to avoid this kind of
confusing designs we generally keep iterators as confined as possible -
instead, we pass around "iterator factories" such as IteratorAggregate.
However, that doesn't include arrays, which can be safely iterated
concurrently as well. Hence my proposal.
Essentially this is like Iterable but excludes Iterator.
Thoughts? TY