Request for proposal: rename @noescape to @nonescaping


(John McCall) #1

In SE-0097, we rejected the proposal to rename @noreturn to @nonreturning and @noescape to @nonescaping. Our rationale is that we wanted to eliminate these attributes entirely. While we have successfully eliminated @noreturn (using the Never result type), and greatly diminished the prevalence of @noescape (by making it the default for parameters), we haven't actually completely eliminated the need for the latter because it is sometimes still useful to mark local variables as storing a non-escaping closure. Furthermore, we may find ourselves wanting to be able to track other kinds of values statically, which would require similar escape analysis, often in situations where we would not be able to default to non-escaping semantics. The rationale is therefore deficient, and we should revisit this decision in order to fully deprecate @noescape in favor of a new spelling @nonescaping.

This would be churn, but I feel it's very well-motivated churn.

Adding this deprecation warning and the corresponding fix-it to the compiler should be a very straightforward patch that I wouldn't expect to require deep compiler familiarity or C++ expertise.

(Note to self: Apple is tracking this idea internally as rdar://47722003)


(John McCall) #2

Wait, nevermind, sorry for the noise. I saw a bug report, forgot that this was already completely deprecated, and got carried away by abstract reasoning. If we ever add new uses of this attribute, we'll obviously add them under the consistent spelling.


(John McCall) #3