[swift-evolution] Enums and Source Compatibility

Jordan Rose jordan_rose at apple.com
Thu Sep 21 13:48:26 CDT 2017


> On Sep 20, 2017, at 16:15, Dave DeLong <swift at davedelong.com> wrote:
> 
> Hi Jordan,
> 
> One thing I’m still not clear on exhaustive vs non-exhaustive…
> 
> What will stop a developer from releasing an exhaustive enum in version 1 of their library, and then adding a new case in version 2?
> 
> With ABI stability and libraries getting updated independently of apps, this can be a major problem.

We have some ideas to deal with this, though nothing promised yet:

- A checker that can compare APIs across library versions, using swiftmodule files or similar.
- Encoding the layout of a type in a symbol name. We could have clients link against this symbol so that they’d fail to launch if it changes, or just check the list of exported symbols to make sure it didn’t change.

The feature’s useful even if we have to do it by hand for now, but it’s a good question to ask. I’ll mention this in the proposal under “Future directions”.

Jordan


More information about the swift-evolution mailing list