Skip to content

Commit b429d92

Browse files
committed
Clarify API impact of @extensible and add alternatives considered section
1 parent 6fefb29 commit b429d92

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

proposals/NNNN-extensible-enums.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ Changing the annotation from `@extensible` to `@frozen` is a source compatible
176176
change and will only result in a warning code that used `@unknown default:`
177177
clause. This allows developers to commit to the API of an enum in a non-source
178178
breaking way.
179+
Adding an `@extensible` annotation is a source breaking change in modules that
180+
have **not** enabled the `ExtensibleEnums` language features or are compiled
181+
with resiliency.
179182

180183
## Effect on ABI stability
181184

@@ -192,4 +195,14 @@ This proposal only affects API resilience of non-resilient libraries, by enablin
192195
We believe that extensible enums should be default in the language to remove the
193196
common pitfall of using enums in public API and only later on realising that
194197
those can't be extended in an API compatible way. Since this would be a large
195-
source breaking change it must be gated behind a new language mode.
198+
source breaking change it must be gated behind a new language mode.
199+
200+
## Alternatives considered
201+
202+
### Only provide the `@extensible` annotation
203+
204+
We believe that the default behaviour in both language dialects should be that
205+
public enumerations are extensible. One of Swift's goals, is safe defaults and
206+
the current non-extensible default in non-resilient modules doesn't achieve that
207+
goal. That's why we propose a new language feature to change the default in a
208+
future Swift language mode.

0 commit comments

Comments
 (0)