[swift-evolution] [Pitch] Move @noescape

Chris Lattner clattner at apple.com
Thu Mar 3 17:57:17 CST 2016

On Mar 3, 2016, at 2:48 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
>> I propose that we remove the former syntax, migrating code to the later form.  This leads to better consistency between our declarations and types, and follows the precedent of inout. @autoclosure should also probably move as well.
>> Thoughts?
> I suppose that makes sense.
> While we're here, it actually occurred to me a while ago that `@noescape` could be applied to reference types as well as closures, indicating that the function doesn't keep them alive in the long run. Would that be useful information for the Swift compiler? I could imagine it helping the compiler to pin down the lifetimes of temporary objects, for instance.

This proposal is merely a syntactic one, but there are a number of orthogonal functionality extensions that we could consider, e.g. allowing noescape members inside structs and enums, supporting noescape optional functions e.g.:

	func f(a : @noescape (()->())?) {…}

etc.  These sorts of proposals are all interesting and useful, but need to be individually motivated, to make sure the complexity burden added by them is justified.


More information about the swift-evolution mailing list