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

Kevin Ballard kevin at sb.org
Wed Dec 30 15:40:59 CST 2015


On Wed, Dec 30, 2015, at 01:33 PM, Joe Groff 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.

Oh that's cute. I'd probably want to say `defer { _ = val }` though, to
make it obvious that this is intentional.

-Kevin Ballard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151230/7a20eea2/attachment.html>


More information about the swift-evolution mailing list