The implementation of your "sugar" can be shortened:
Awesome, can you throw into an issue?
Re:Native Mac APIs for Go
by lunixbochs on Thursday February 04, 2021 @02:23PM
(#26028797)
wow, thanks!
Keep in mind that the reason the `@autorelease` syntax is faster is primarily due to ARC optimizations (which don't apply here, since you're not using ARC).
Calling the `_objc_autoreleasePoolXX` functions are still likely to be faster than the NSAutoreleasePool objects, but only because you're avoiding the Objective-C message sends.
This answer looks like a better overview of what the runtime is doing: https://stackoverflow.com/a/21010442
The @autoreleasepool block seems equivalent to this:
You could maybe provide sugar for it like this: https://play.golang.org/p/dljXN3BdEGr