[swift-evolution] [Draft] Apply -ed/-ing rule to core functional methods (e.g. filter => filtered)

Dave Abrahams dabrahams at apple.com
Mon Jun 20 16:30:55 CDT 2016


on Fri Jun 17 2016, Brent Royal-Gordon <swift-evolution at swift.org> wrote:

>> – What sin(x) should do is unambiguous, unlike array.filter { ... }.
>
> A decent argument label, like `including` or even `to`, would fix the
> name `filter`. 

  x.filter(to: isPrime)

? I don't think that reads nearly as well as 

  x.where(isPrime)

even when considering the term-of-art recognizability.

> And as I said, if we feel `filter` is unsalvageable, the alternate
> Smalltalk-lineage `select` is clearer.

Than “where?”

>> – There's very significant brevity issues here, e.g. hyperbolicArcTangent() vs atanh().
>
> Sure, but `mappingAndFlattening(to:)` would have brevity issues as
> well. (You didn't think the API Guidelines merely meant "add -ed or
> -ing to everything", did you?)

That would, IMO, be:

  x.flatMapping(fourCopies)

-- 
Dave



More information about the swift-evolution mailing list