79520616

Date: 2025-03-19 15:19:02
Score: 1
Natty:
Report link

Based on @CouchDeveloper and your own reply, you can create/add those global function overloads possibly to keep the same ergonomics:

func autoreleasepool<Result>(_ perform: @escaping () async throws -> Result) async throws -> Result {
    try await Task {
        try await perform()
    }.value
}

func autoreleasepool<Result>(_ perform: @escaping () async -> Result) async -> Result {
    await Task {
        await perform()
    }.value
}
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @CouchDeveloper
  • Low reputation (0.5):
Posted by: paescebu