[swift-evolution] SE-0187: Introduce Sequence.filterMap(_:)

BJ Homer bjhomer at gmail.com
Thu Nov 9 12:43:05 CST 2017


> 
> On Nov 9, 2017, at 11:35 AM, Tino Heth <2th at gmx.de> wrote:
> 
> 
>> This proposal only proposes renaming the “filterNonesAndMap” variant (though that name is misleading, it would be “filterNonesAfterMapping” if anything); the other uses of flatMap will remain unchanged.
> … then it should be really right: As I learned in the thread, there is a map step before filter, and another map afterwards - so „filterNonesAfterMappingAndMap“ (that’s why I don’t like the use of the term „filter“ here — if you want an accurate name that contains this verb, it gets quite complicated…)
 
But obviously “filterNonesAfterMappingAndMap” is not a name we’re going to end up with. You can argue that “filterMap” is not completely faithful to the internal implementation, but I think it’s clearly better than “flatMap” in this case, which is even more incorrect. I’m not opposed to finding a better name than “filterMap”, but so far I haven’t seen one.

-BJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171109/d03657d7/attachment.html>


More information about the swift-evolution mailing list