On Nov 9, 2017, at 11:36 AM, Kevin Ballard via swift-evolution 
<swift-evolution@swift.org> wrote:
> 
> On Wed, Nov 8, 2017, at 09:29 PM, Paul Cantrell via swift-evolution wrote:
>> The problem in the Doodads example is that the name flatMap is used to 
>> identify two distinct intents: concatenating arrays and filtering nils. One 
>> can argue that those two operations are, in some lofty abstract sense, if 
>> you squint, two instances of some more general pattern — but I don’t think 
>> it’s fair to say that they represent the same intent. These separate intents 
>> deserve separate names.
> 
> They absolutely represent the same intent if you think of an optional as a 
> collection of zero or one elements.
> 
> -Kevin Ballard

But as `Optional` does not conform to collection, I would suggest that the vast 
majority of of developers do _not_ think of them as a collection of zero or one 
elements. (I certainly don’t know any who naturally think of it that way.) We 
don’t treat Optional as a collection anywhere else in the API, and it seems odd 
to do so in just this one case.

-BJ
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to