That is hard to wrap the head around, can you define a pattern? Does not a pattern in a usual case require an equality test? (I know there are other patterns, but in the above example I could imagine there is an internal
~= that falls back to
Since you limited
case a with
private(init), the static case initializer would not leak out to other files, which in my brain will prevent you from writing
case .a: in the switch statement in another file.
This was a perfect example why I think pattern matching will error out in your example as well.
If that's not true, then I guess I don't understand pattern matching after 5 years working in Swift.