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

Gwendal Roué gwendal.roue at gmail.com
Wed Nov 15 23:59:02 CST 2017


> Le 16 nov. 2017 à 06:29, Matt Gallagher via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> On the topic of a method that "compacts" without also mapping... I think this encourages poor designs that should be using lazy transformations instead of aggregate processing. There is almost always a way around a bare flatten. The obvious quirkiness of `filterMap { $0 }` (or whatever the name ends up being) should be seen as a nudge to re-think the algorithm leading up to that point.

I can hear the argument, but it errs in the side of premature optimization. Besides, seq.lazy.compacted() still has a meaning.

Gwendal

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


More information about the swift-evolution mailing list