[swift-evolution] Pitch: @autoreleasepool attribute for loops

Thorsten Seitz tseitz42 at icloud.com
Mon Jan 11 11:15:23 CST 2016


Ruby has rules for how "return", "next" (= continue) and "break" behave in closures which match the expectations quite well. It allows next and break to return values, too.

-Thorsten 

> Am 09.01.2016 um 21:21 schrieb Greg Parker via swift-evolution <swift-evolution at swift.org>:
> 
> 
>> On Jan 8, 2016, at 10:00 PM, Jacob Bandes-Storch via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> I sympathize with the problem statement, but I wonder if we should instead be considering ways of allowing control-flow statements (break, continue, return) to work from inside @noescape closures.
> 
> @noescape is insufficient to allow that. You need more constraints on the closure's caller, perhaps even cooperation from the closure's caller depending on how the control flow is supposed to work.
> 
> Off the top of my head:
> * The closure's caller can't call the closure more than once. Or if it does, it needs to participate in the control flow system somehow. (Example: what does `break` do in the middle of map().)
> * Return values are complicated. You might need to limit the system to void returning closures only.
> * Defining the closure in one place and handing it off in another is complicated. You might need to limit the system to closure literals only.
> 
> 
> -- 
> Greg Parker     gparker at apple.com     Runtime Wrangler
> 
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160111/61257836/attachment.html>


More information about the swift-evolution mailing list