[swift-evolution] [Proposal] Scoped resources (like C# using statement)

Kevin Ballard kevin at sb.org
Wed Dec 30 17:19:20 CST 2015

On Wed, Dec 30, 2015, at 03:12 PM, Kevin Wooten via swift-evolution wrote:
>>> Another possibility I've thought of is defining `defer { val }` to
>>> guarantee that val remains alive until the defer fires on scope
>>> exit. That might let us leave `defer` as the one "guarantee
>>> something happens exactly at scope exit" language construct.
> What about this…
> defer let val = grabOrCreateSomething() {  return; }
> Seems natural once you learn guard.

Natural? I have no idea what you're expecting that expression to
actually do. What is a "defer let"?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151230/521f2e36/attachment.html>

More information about the swift-evolution mailing list