[swift-evolution] Stdlib closure argument labels and parameter names

Sean Heber sean at fifthace.com
Mon Jun 27 11:10:27 CDT 2016


Just tossing my vote in the hat for renaming .filter() to something like .select() since that better matches what it does, IMO. “Filter” is almost like the opposite word from what it should be since the closure returning true is what decides what is included in the results, not what is filtered *from* the results. I mean, yeah, I can kind of understand the logic either way, but it’s always been one of those strange mental gymnastics things.

Personally I’m not a huge fan of the terms of art exemptions as I feel like most of the functional programming terms of art are a poor fit for Swift in particular and often needlessly esoteric when first encountered (fold? reduce? map?). The same can be said about many mathematical terms as well such as “floor” and “ceil" which, at least in my experience, we learned throughout schooling years as being called rounding up and down. (Perhaps that has changed?)

l8r
Sean


> On Jun 27, 2016, at 11:02 AM, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Jun 27, 2016, at 8:40 AM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>> “each” is just what's required to make “so” read sensibly.
>> 
>>    (0..<100).filter(so: isPrime)
>> 
>> doesn't make any obvious sense.
> 
> 
> Shouldn't there be a term of art exemption for `filter(_:)`. Otherwise why not use `select(where:)`.
> 
> -- E
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list