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

Erica Sadun erica at ericasadun.com
Thu Jun 23 17:08:59 CDT 2016


> 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.

-- E

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


More information about the swift-evolution mailing list