<div dir="ltr"><div>I think this highlights some of the confusion around the current curried convention. Void methods are curried as A -> () -> (), which means you would use it like:</div><div><br></div><div><div>UIView.removeFromSuperview # => UIView -> () -> ()</div><div>UIView.removeFromSuperview(view) # => () -> ()</div><div>UIView.removeFromSuperview(view)() #> ()</div></div><div><br></div><div>I find this confusing because removeFromSuperview reads as an action, yet UIView.removeFromSuperview(view) does not perform the action but rather is an action itself that requires a further invocation ().</div><div><br></div><div>With arguments flipped we would have:</div><div dir="ltr"><div><br></div><div><div>UIView.removeFromSuperview # => () -> UIView -> ()</div><div>UIView.removeFromSuperview() # => UIView -> ()</div><div>UIView.removeFromSuperview()(view) #> ()</div></div><div><br></div><div>It now reads to me that UIView.removeFromSuperview() is the action that will do the removing, and UIView.removeFromSuperview()(view) is applying the action to a view.</div><div><br></div><div>I don’t advocate using removeFromSuperview in this manner, but if one were to I believe the latter convention is easier to reason about without having to look up types in a playground (as I had to do a few times to write this :P)</div><br><br><div class="gmail_quote"><div dir="ltr">On Sun, Mar 13, 2016 at 1:50 PM Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On Mar 13, 2016, at 11:30 AM, Stephen Celis <<a href="mailto:stephen.celis@gmail.com" target="_blank">stephen.celis@gmail.com</a>> wrote:<br>
><br>
>> On Mar 13, 2016, at 1:18 PM, Erica Sadun <<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>> wrote:<br>
>><br>
>> Since removeFromSuperview doesn't take a UIView argument, it sounds like what you're looking for is<br>
>> something that acts like "apply", to apply a lambda/closure/selector/whatever to each member of a collection.<br>
>><br>
>> view.subviews.apply(UIView.removeFromSuperview)<br>
>><br>
>> -- E<br>
><br>
> This is what `forEach` currently does with the existing curried static syntax, right?<br>
><br>
> I was more interested in the implications of an example brought up in the OP:<br>
><br>
> frames.map(CGRect.insetBy(-10, -10))<br>
><br>
> - Stephen<br>
<br>
forEach currently does f(x).<br>
apply would do x.f()<br>
<br>
-- E<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div></div></div>