I was going to ask about if we should add expressions like:
EXPRESSION “cases” IDENTIFIER
as a way to test
enum-cases inline. Then I found out about SE-0155 “Normalize Enum Case Representation,” which allows cases to share a base name. Has this been implemented for Swift 5 (and the SE-0155 page not yet updated)? Or is it still being worked on?
My other query is: how can base-name-sharing
enum cases differ? I know you can’t have a zero-parameter payload; the case must either be payload-less or use a single dummy
Void parameter (or both). For cases with parameters, do they have to be all labeled or all labelless? Or are partially-labelled payloads allowed?
Right now I’m imagining:
xxx cases myCase // all cases named “myCase” xxx cases myCase(:::) // all cases named “myCase” with 3 parameters xxx cases myCase(_: _: _:) // all cases named “myCase” with 3 label-less parameters xxx cases myCase(first: :) // all cases named “myCase” with 2 parameters, first named “first”, second with any label (including none)
Are cases with the same name, parameter count, and labels allowed that differ only by parameter type? I hope not, as that would require use to add the types to the above expressions for differentiation.