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

Anton Zhilin antonyzhilin at gmail.com
Fri Jun 24 09:11:22 CDT 2016


Vladimir.S via swift-evolution <swift-evolution at ...> writes:

> Do you mean *sorted*(by:) ? Or I'm missing something in naming rules?

IIRC, sort is mutating and sorted is nonmutating (copying) version.
Also, I forgot `initial` parameter in `reduce`.

> > Data flow is an area where code becomes the less understandable when
> > more visual clutter is added. In my opinion,
> >
> > array.filter(isEven).map(square).reduce(sum)
> >
> > reads better than
> >
> > array.filter(suchThatTrue: isEven).map(applyingTransformation:
> > square).reduce(accumulatingResultBy: sum)
> >
> > What do you think?
> 
> +100. I even want to brought the term-of-art argument here. IMO These 
> functions are expected to be called without any parameter names.

That would probably be a good scenario, but core team needs to release 
their grip on strictly following new naming conventions.



More information about the swift-evolution mailing list