[swift-evolution] Changing the curried static methods

Stephen Celis stephen.celis at gmail.com
Sun Mar 13 12:09:47 CDT 2016


> On Mar 13, 2016, at 9:17 AM, Tino Heth via swift-evolution <swift-evolution at swift.org> wrote:
> 
> A relegated issue is that it's complicated to use curried static methods with map & foreach
> (for example, this
> view.subviews.forEach(UIView.removeFromSuperview)
> doesn't work )

With a final Void return value, wouldn't that just become the following?

    view.subviews.forEach(UIView.removeFromSuperview())

I have to wonder how common this pattern is, anyway, when the following is as short and arguably easier to read:

    view.subviews.forEach { $0.removeFromSuperview() }

Does the current convention give us anything else?

It's easy enough to define a `flip` library function that converts `A -> B -> C` to `B -> A -> C`, but I do see the latter being a more powerful default than the former, even if it's unconventional.

Stephen


More information about the swift-evolution mailing list