[swift-evolution] Value Subtypes and Generalized Enums, a manifesto
Matthew Johnson
matthew at anandabits.com
Thu Feb 16 16:44:03 CST 2017
I have been thinking a lot about enums and value subtyping lately and decided to write down the ideas I’ve been thinking about. The result is a manifesto-style document that explores a broad landscape of features that could eventually lead to proposals (at the right time, of course).
I’m presenting this document to the list now mostly because I am not sure which of these features (if any) might be relevant to ABI stability, particularly with respect to standard library APIs. I do not wish to distract the list from the focus on Swift 4, phase 1. Let’s try not to get distracted by exciting ideas that won’t be in scope until at least phase 2. Feel free to send feedback off list if you’re interested in discussing ideas that may not be relevant to Swift evolution at this time.
Because this document covers a pretty broad range of topics it might be a good idea to start a new thread before jumping in to discussion about a specific aspect of it. Please consider doing that if it is relevant before responding directly to this thread.
As this is a relatively large document I am only providing a link: https://gist.github.com/anandabits/5b7f8e3836387e893e3a1197a4bf144d
To whet your appetite, the topics covered include:
* Definition of value subtyping
* Transitivity of value subtypes
* Generic supertype constraints
* Axiomatic value subtype relationships
* Enums: Value Subtype Relationships by definition
* Nominal case types
* Nominal unions
* Generic enums and Optional
* Cases with unbound generic arguments
* Structural Unions
* Enum subtypes
* Inline enum subtypes
* Inline generic enum subtypes
* Conditional cases (and GADTs)
* Inline case types
* Nominal cases with inline types
* Case type implementation sharing
* Shared stored properties
* Subenum stored properties
* Shared methods and computed properties
* User-defined case patterns
More information about the swift-evolution
mailing list