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()
}
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution