> On Mar 21, 2016, at 11:43, Dmitri Gribenko <[email protected]> wrote: > > On Mon, Mar 21, 2016 at 9:37 AM, Jordan Rose <[email protected]> wrote: >> -1 for the signature change. The most common case of autoreleasepool does >> not return a value and has a multi-statement body that prevents the result >> type from being inferred. This needs to continue to work: >> >> autoreleasepool { >> foo() >> bar() >> } > > It seems to work for me: > > func poolPush() {} > func poolPop() {} > > public func autoreleasepool<Result>(@noescape code: () throws -> > Result) rethrows -> Result { > poolPush() > defer { poolPop() } > return try code() > } > > func foo() {} > func bar() {} > > autoreleasepool { > foo() > bar() > }
Um. Thank you for actually testing it! Objection withdrawn; changed to a +1. :-) Thanks, Dmitri, Tim. No overload needed. Jordan _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
