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

Dave Abrahams dabrahams at apple.com
Sat Jun 25 17:35:20 CDT 2016

on Thu Jun 23 2016, Erica Sadun <erica-AT-ericasadun.com> wrote:

>> On Jun 23, 2016, at 12:39 AM, David Hart <david at hartbit.com> wrote:
>>> -      for test in removeFirstTests.filter({ $0.numberToRemove == 1 }) {
>>> +      for test in removeFirstTests.filter(
>>> +        suchThat: { $0.numberToRemove == 1 }
>>> The difference between `filter` and `forEach` is that `forEach` is explicitly 
>>> procedural while `filter` is functional.  I do not like functional chainable
>>> calls being modified to use explicit external labels in this way. 
>>> I'd prefer no label here.
>> Quick aside. Eric, if you prefer no label here, why did you not also
>> prefer no labels for contains and elementsEqual? They also have very
>> functional. But if we must have a label, I’d vote for `where`.
> contains and elementsEqual both return Booleans which are almost never chained.

What does chaining have to do with the presence of argument labels?


More information about the swift-evolution mailing list