@unrequired in function signature for optional closure parameters

Yes, we could get away without having @escaping at all. We could assume that a closure could always escape, and Swift would still be well-defined.

However, having @escsping is nice, both for the compiler and for users. Likewise, having it for optional closures would also be nice.

I’m not arguing against its utility.

I’m arguing that not having it, does not constitute undefined behavior. Secondary, I’m arguing that introducing new keywords, is not worth the cost. And thirdly, I’m arguing that non-escaping optional closures are pretty niche.

But it is obviously a missing feature that you are not able to declare such closures, and it means that (the well-defined) behavior must be communicated through some other means, such as naming and/or documentation.

2 Likes