Not sure I see how they're in different scopes. Can you explain that to me?
-- E > On Jun 6, 2016, at 2:18 PM, donny wals <donnyw...@gmail.com> wrote: > > Erica, > > Maybe my phrasing was a bit off, but in my proposal it’s really important > that the return and the defer are in the same scope. In your example the > allocate memory line is in a different scope that the guard/else statements. > Therefor, the defer { release memory } shouldn’t be executed if the guards > don’t hold. > > D > >> On 06 Jun 2016, at 22:09, Erica Sadun <er...@ericasadun.com> wrote: >> >> This is problematic. You may want to defer code at different points with >> different reasons. For example, you might not want to trigger defer until >> after some preconditions have been met.: >> >> guard something >> guard something >> allocate memory; defer {release memory} >> >> -- E _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution