[pattern-switch] sealed switch

Guy Steele guy.steele at oracle.com
Fri Sep 4 02:34:47 UTC 2020

I just want to interject that I really dislike the terminology (and therefore the syntax) “sealed switch” because it is too likely to confuse Joe Programmer (or me) into thinking that it necessarily makes use of, or is used in conjunction with, a sealed type.  One might also misconstrue it to mean that the set of switch labels is fixed and cannot be added to later!

I much prefer the story that it is a kind of switch that insists that _some_ switch label be chosen, rather than silently allowing no switch label to be matched.  I happen to think that `switch case` is a better way to allude to that story, but there may be better ways.  The story is more important than the syntax.  In my mind, it is from this story that the requirement for totality is derived.

More information about the amber-spec-experts mailing list