<div dir="ltr">+1 for this. A clear win with regard to simplification.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 22, 2016 at 8:41 PM, Kevin Lundberg via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><span class="">
On 2/22/2016 6:18 PM, Joe Groff wrote:<br>
<blockquote type="cite">
<br>
<div>If I understand the intent of `weakify` correctly, I think
this kind of use case is already pretty severely curtailed by
our removing the tuple splat feature, since you can no longer
make `weakify` generic across multiple method signatures. Like
the tuple splat feature, an explicit variadic splatting feature
ought to make this possible for flattened method signatures:</div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>func weakify<Class: class, Args, Result>(instance:
Class, method: (Class, Args...) -> Result) -> (Args...)
-> Result {</div>
<div> return {[weak instance] args... in method(instance,
args...) }</div>
<div>}</div>
</blockquote>
<br>
<div>-Joe</div>
</blockquote>
<br></span>
Agreed on the tuple splat removal point, but the common use cases I
use this for today don't apply weakify to methods with more than one
argument in practice. Even so, your example here is admittedly a
pretty simple change to make to keep existing functionality if the
curried form of this goes away, and this language change would make
it haeder for people who want to do something similar to create a
retain cycle scenario if they don't use something like weakify to
safely pass method references around.<br>
<br>
I do like the current behavior, but given this you've convinced me
that it may be best for it to change :)<br>
<br>
- Kevin<br>
</div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">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>
<br></blockquote></div><br></div>