[swift-evolution] [Review] SE-0061: Add Generic Result and Error Handling to autoreleasepool()

Ben Rimmington me at benrimmington.com
Sat Apr 23 14:02:20 CDT 2016


<https://github.com/apple/swift-evolution/blob/master/proposals/
0061-autoreleasepool-signature.md>

+1. I believe the proposal should be accepted.

However, cross-platform libraries would still need to write:

#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS)
    import func ObjectiveC.autoreleasepool
#else
    func autoreleasepool<Result>(
        @noescape body: () throws -> Result
    ) rethrows -> Result {
        return try body()
    }
#endif

Charles Srstka suggested an @autoreleasepool attribute:

<http://thread.gmane.org/gmane.comp.lang.swift.evolution/2796>

-- Ben




More information about the swift-evolution mailing list