<div dir="ltr">I also thought on the problem, and I agree with your solution. It keeps things simple.<div>I agree with this specific name -- IterableOnce (not IterableAtLeastOnce).</div><div>IterableOnce contains Iterable -- and that plays very nicely with IteratorProtocol name.</div><div>IterableOnce is not a single word, but it's not too long, compared to some other options.</div><div>Functions working with IterableOnce will always imply single-pass, and with Collections -- multi-pass. It might seem odd that Collection conforms to IterableOnce, but I consider that a minor drawback.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-13 1:55 GMT+03:00 Dmitri Gribenko via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'd like to continue the discussion of the issue raised by David Waite<br>
inhttp://<a href="http://thread.gmane.org/gmane.comp.lang.swift.evolution/21295/" rel="noreferrer" target="_blank">thread.gmane.org/gmane.comp.lang.swift.evolution/21295/</a>:<br>
<br>
> My main motivation for proposing this is the potential for developer confusion. As stated during one of the previous threads on the naming of map, flatMap, filter, etc. methods on Sequence, Sequence has a naming requirement not typical of the rest of the Swift standard library in that many methods on Sequence may or may not be destructive. As such, naming methods for any extensions on Sequence is challenging as the names need to not imply immutability.<br>
<br>
I'd like to focus on a particular point: methods on Sequence can<br>
consume elements, but the APIs are not markedmutating.<br>
<br>
Dave Abrahams, Max Moiseev, and I have discussed this issue and we<br>
agree this problem is severe and worth solving, we also think that the<br>
likely solutions would be source-breaking, so it is important that we<br>
discuss it now.<br>
<br>
We have discussed a few options.<br>
<br>
- Rejected option: remove Sequence, let IteratorProtocol model<br>
single-pass data streams<br>
<br>
- Rejected option: use a syntactic marker, like sequence.consumedIn.map {}<br>
<br>
- Rejected option: mutating APIs on Sequence, non-mutating APIs on Collection<br>
<br>
Proposed: rename Sequence to IterableOnce or TraversableOnce. We think<br>
that Sequence does not convey the single-pass restriction clearly. The<br>
term "sequence" has been used in math (as in "integer sequence"), and<br>
since the math domain does not have mutation, "sequence" can be<br>
understood to mean "multi-pass", since you can traverse a sequence of<br>
integers an arbitrary number of times.<br>
<br>
We think that only the last option is viable in the Swift language as<br>
it exists now, without creating an undue burden for API vendors and<br>
users.<br>
<br>
For more details about rejection options, please see the full writeup:<br>
<a href="https://gist.github.com/gribozavr/47f4717f3afc762549383e94da7f748b" rel="noreferrer" target="_blank">https://gist.github.com/gribozavr/47f4717f3afc762549383e94da7f748b</a><br>
<span class="HOEnZb"><font color="#888888"><br>
Dmitri<br>
<br>
--<br>
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>>*/<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</font></span></blockquote></div><br></div>