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

Gwendal Roué gwendal.roue at gmail.com
Thu Nov 16 03:52:42 CST 2017

> The optional itself will stand for the boolean needed by the filtering operation.

What I meant here is that "filterMap" can only click in a developer's mind if the the developer uses Optional as a Bool. When the closure returns nil, that nil stands for false in the filtering operation. When the closure returns a `some`, that some stands for true in the filtering operation.

Put in another way: to properly explain "filterMap" to someone who already knows "filter", then you have to explain that optionals are used as booleans.

Now if one has to answer the canonical question "Does this proposal fit well with the feel and direction of Swift?", then one has to admit that the confusion of Optional with Bool has been rejected a long time ago as not fitting well with the direction of Swift.


More information about the swift-evolution mailing list