[swift-evolution] [Accepted and Focused Re-review] SE-0187: Introduce Sequence.filterMap(_:)

BJ Homer bjhomer at gmail.com
Thu Nov 16 10:04:16 CST 2017


> On Nov 15, 2017, at 11:07 PM, Gwendal Roué via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> Le 16 nov. 2017 à 06:29, Matt Gallagher via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> a écrit :
>> 
>> My opinion is that filterMap is the right choice of name.
>> 
>> I'm completely biased, given that I already have a Swift library that uses filterMap, in exactly this context, for a Reactive Programming library:
>> 
>> 	https://github.com/mattgallagher/CwlSignal/blob/22f1d47895896d7b55bc59a4ee5394071f3c84cf/Sources/CwlSignal/CwlSignalReactive.swift#L453?ts=3 <https://github.com/mattgallagher/CwlSignal/blob/22f1d47895896d7b55bc59a4ee5394071f3c84cf/Sources/CwlSignal/CwlSignalReactive.swift#L453?ts=3>
> 
> Another popular Reactive Programming Library uses filterMap with a different signature, and a different meaning: https://github.com/RxSwiftCommunity/RxSwiftExt/blob/3.0.0/Source/RxSwift/filterMap.swift#L32 <https://github.com/RxSwiftCommunity/RxSwiftExt/blob/3.0.0/Source/RxSwift/filterMap.swift#L32>
> 
> There are already different interpretations on "filter" in "filterMap" in the wild.
> 
> Gwendal Roué
> 

This library is using filterMap in exactly the same way proposed, except that they use a custom result type instead of Optional. So yes, it has a different signature, but I don’t think it has a different meaning. It’s still running a map operation that may filter some values out.

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


More information about the swift-evolution mailing list