[swift-evolution] [Review] SE-0006 Apply API Guidelines to the Standard Library

Dave Abrahams dabrahams at apple.com
Tue Feb 2 12:52:46 CST 2016


on Tue Feb 02 2016, Janosch Hildebrand <swift-evolution at swift.org> wrote:

>>> * This is not a disagreement but I'd be interested in hearing the
>>> reasons for replacing Generator(Type) with Iterator(Protocol) if
>>> someone finds the time. I can speculate of course but it's probably
>>> easier for someone to give me a short summary :-)
>> 
>> I think these messages give all the details:
>> 
>> http://news.gmane.org/find-root.php?message_id=m2h9i4gffx.fsf%40eno.apple.com
>> <http://news.gmane.org/find-root.php?message_id=m2h9i4gffx.fsf%40eno.apple.com>
>> http://article.gmane.org/gmane.comp.lang.swift.evolution/5344
>> <http://article.gmane.org/gmane.comp.lang.swift.evolution/5344>
>
> Sorry, maybe I'm missing something or my question was unclear, but
> isn't that more the rationale for dropping the "Type" suffix?
>
> I'm asking more about the switch from `Generator` to `Iterator` and
> by that argument wouldn't `GeneratorProtocol` work just as well?
>
> My assumption was that the switch was probably motivated by
> a) Iterator is the more well known concept

+1

> b) Generator is more of a term of art and IIUC Swift's Generators
> aren't Generators in the strictest sense

Not that one so much, IIRC.  The main thing was that to at least one
person, the method name “generate()” was obviously wrong and hard to
tolerate.  Once you start thinking about other names for that, it leads
naturally to considering other names for the things it returns.

> but I could be wrong in a lot of ways, hence why I'm asking :-)

-- 
-Dave



More information about the swift-evolution mailing list