Type: New Feature
This is my first post, so please let me know if I have any mistakes in the filing process .
I'd like to propose an idea for Swift. Essentially, my idea would pertain to the scenario when you have a struct/class when you have static members used for initialization. Imagine the following example:
When switching through an instance of Section, you must define a default case, even though the default case should never have to be called. One possibility would be the introduction of 'case' members that would replace the static member initializers. Imagine:
This implementation would (somehow) allow for the compiler to recognize that these methods should be used for switch statements and remove the need for default cases if the type uses a hypothetical `exhaustible` attribute.
An alternative idea would be to have an `Exhaustible` protocol:
Then perhaps the compiler could (somehow) know that a default case is not needed. I do not know how this could look/work with static functions (such as the tertiary case).
Maybe this isn't a good idea or has been suggested before, but I couldn't find anything online. If anyone has feedback, I'd love to hear it! .