something like this
enum State { case A, … } switch (fromState, toState) { case (.A, .B): … }
in which you want to make sure you didn't forget a combination.
something like this
enum State { case A, … } switch (fromState, toState) { case (.A, .B): … }
in which you want to make sure you didn't forget a combination.
(I could not find the link anymore, but I remember reading a blog post about how Rust `match` statement are in fact solving an instance of SAT).
Instead, I went with Luc Maranget's classic approach and figured out a way to adapt it to a language with subtyping (with a ton of work from Johnni Winther to figure out all of the hard complex cases around generics):
https://github.com/dart-lang/language/blob/main/accepted/fut...
The performance (in the prototype!) was dramatically better. You can always make pattern matching go combinatorial, but I haven't seen any real-world switches get particularly slow with our approach yet, and we have some fairly large tests of matching on tuples of enums.
It breaks at around 50 cases in the switch.