[swift-evolution] [RFC] New collections model: collections advance indices
Trent Nadeau
tanadeau at gmail.com
Tue Mar 1 21:03:22 CST 2016
Ah. Thanks. I've read through that proposal before but totally forgot that
change.
On Tue, Mar 1, 2016 at 10:01 PM, Dmitri Gribenko <gribozavr at gmail.com>
wrote:
> On Tue, Mar 1, 2016 at 6:55 PM, Trent Nadeau <tanadeau at gmail.com> wrote:
> > Why is the protocol for iterators called IteratorProtocol instead of
> > Iterator or Iterable? If that is/was discussed elsewhere, I apologize,
> but I
> > don't remember seeing that particular name before. Is that new to this
> > proposal?
>
> I'm using the new names introduced by SE-0006
>
> https://github.com/apple/swift-evolution/blob/master/proposals/0006-apply-api-guidelines-to-the-standard-library.md
>
> The protocol is not called Iterator to disambiguate it with the
> Iterator associated type in Sequence from the protocol:
>
> protocol Sequence {
> associatedtype Iterator : IteratorProtocol
> }
>
> It is not called Iterable because that would have the wrong meaning
> (Sequence is iterable, the iterator iterates over its elements).
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
>
--
Trent Nadeau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160301/49eb71ae/attachment.html>
More information about the swift-evolution
mailing list