<div dir="ltr">The pattern<div><br></div><div>someObject.callBack() { [weak self] in</div><div> if let me = self {</div><div> me.doSomething()</div><div> ...<br></div><div></div><div> }</div><div>}</div><div><br></div><div>and friends (guard, etc) are pretty common. I'd love to have some sugar for that - maybe "firm"</div><div><br></div><div><div>someObject.callBack() { [firm self] in</div><div> self.doSomething()</div><div> ...</div><div>}<br></div><div><br></div></div><div>where firm guarantees that the named variable[s] won't be nil - if they are, the block is skipped.</div><div><br></div><div>I think this would make the language easier to use (skipping the complexities/distinction between weak/unowned), more concise, and generally more pleasant.</div><div><br></div><div>Thoughts?</div><div><br></div><div>Thanks,</div><div>Kurt</div><div>-- <br><div class="gmail_signature">kurt@CircleW.org<br><a href="http://www.CircleW.org/kurt/" target="_blank">http://www.CircleW.org/kurt/</a><br></div>
</div></div>