<div dir="ltr">I get that :) but I think it would be helpful to go beyond the no-op case and help solve the "strongify" situation that exists in the larger problem domain.<div><br></div><div>The "strongify" issue – to me – is mostly about avoiding the need to rename the captured var in the block to allow for the reference to become a strong reference. I feel it would be great to tackle that for more then the no-op case.</div><div><br></div><div>In my experience I have had what once was "a simple no-op on nil case" turn into "if nil do some book keeping and no-op the rest" often enough to desire a broader solution.</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Feb 19, 2016 at 2:03 PM Kurt Werle <<a href="mailto:kurt@circlew.org">kurt@circlew.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 19, 2016 at 1:39 PM, Shawn Erickson 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 dir="ltr"><div><br></div><div>For example [guard self] capture option supports one specific situation without the ability of the block to take alternate actions in the situation of weak self being nil and also requiring no return blocks. This is great obviously for that particular situation however it doesn't really help with the other situations.</div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>That's the beauty of it. If you want to do something else, this isn't what you want. This is just a simple bit of sugar to get rid of the very common use case where you have a nilable/void callback that you only want executed if self is not nil.</div><div><br></div><div>If you want/need to do something more complicated, then</div><div>{ [unowned self] in</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> guard self != nil else {</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> Do the other thing</div><div> }</div><div>}</div></div><div>is great. It's not boilerplate because you're doing something useful in the else case.</div><div><br></div><div>I do still prefer the [unowned self]? syntax, though. It feels so similar to object?.doSomething(). If the lvalue is nil, you get nothing!</div></div></div><div dir="ltr"><div class="gmail_extra"><div><br></div><div>Kurt</div>-- <br><div>kurt@CircleW.org<br><a href="http://www.CircleW.org/kurt/" target="_blank">http://www.CircleW.org/kurt/</a><br></div>
</div></div></blockquote></div>