I've moved from thinking "we don't have time to implement a composable syntax" to "we actually don't want a composable syntax", per this point in the revised proposal:
A key point of this discussion is that as proposed
unknown case
merely produces a warning when the compiler can see that some enum cases are unhandled, rather than an error. This is what makes it difficult to implement in non-top-level positions. If the compiler produced an error instead, it would make more sense to use a pattern-like syntax forunknown case
now (see the naming discussions under "Alternatives considered"). However, if the compiler produced an error, then adding a new case would not be a source-compatible change.
Maybe I should make that stronger. If "non-breaking change" is a priority, then we need to emit a warning; if we emit a warning, the feature doesn't make sense in non-top-level positions. See also the discussion under Mixing unknown case
and default
.
I think TheEnum._
is a terrible spelling for this. That could match any case of TheEnum
, sure, but it leaves out the diagnostic part.
#unknown
was chosen by analogy with #available
. Other non-directive-y #
-features include #selector
and #keyPath
(the old one), but I guess those are regular expressions.