What is to be done about rethrowing protocols?

It seems like rethrowing protocols are in an odd state at the moment: The feature didn't complete an evolution process, and yet it is implemented in the language for us to use.

Since rethrowing protocols are already in the language and types such as async sequences depend on them as is, it's too late for an evolution to occur because we cannot remove or change the feature. This is not really important to me, but there's still an issue around documentation. Currently, the only official acknowledgement of the feature is that initial pitch post, and it's not quite complete. Protocols must be annotated with @rethrows before they can be rethrowing—I don't know if this is intended or not.

If indeed rethrowing protocols are immutable (i.e., it cannot go through an evolution), may we at least get an updated document outlining how to use the feature as it is today? Preferably this would live in the TSPL, but a new post would be an improvement enough, just so that searching "swift rethrowing protocols" returns an up-to-date description.

15 Likes

My hope here is that we can remove them in favor of typed throws.

Doug

15 Likes

Here's a write-up of my attempt to use typed throws to replace rethrowing protocols.

Doug

3 Likes