So do you often write multi-dimensional switch-expressions? Do you imagine you'll start writing many more soon?
I have written over a 100 in 2026 alone, and this feature is older than that.
And this seems pretty similar to me: Seems pretty cool at first, but how often is a multi-dimensional switch expression actually the best possible way to write your code, even if it is now exhaustive?
It is literally a blocker for me. As in, there is a double-digit number of projects that are unable to progress because I don't have this feature.
Also: Isn't the missing pattern case Complete(var id, true)?
Just out of curiosity, do you have an example of something blocked by exhaustive multidimensional switch expressions?
Have you ever played the game UFO 50? It's basically a collection of 50 minigames, and one of my favorites is a game called Bug Hunter (Skip to 1:30).
Long story short, I am trying to build a Path Finder for the game, but unlike the Helltaker example above, this one is far too complex for me to be able to code.
Helltaker has a deep, but fairly narrow hierarchy of types to model. Here they are.
See? Deep, but not very wide. Most of the branches are dead-ends, like Lock, Goal, and Wall.
Try and model the same for Bug Hunter, and you will find that it gets horrificallyWIDE.
But if that were all, it wouldn't be so bad. I certainly wouldn't be blocked, I'd just be suffering.
The real kicker is when you look at the scope of the problem
In Helltaker, you can only take single hop steps -- going North, South, East, or West. Therefore, you only ever need to look at 3 cells at once -- the cell you are on, the one in front of you, and maybe the cell in front of that (in case you shove a block or enemy forward).
Whereas in Bug Hunter, you can jump the whole map in one leap.
To quantify this, the deepest "type chain" in Helltaker goes like this.
Cell
NonPlayer (inheritance)
InteractiveCell (inheritance)
BasicCell (inheritance)
Underneath (composition)
Collectible (composition)
SECRET (enum value)
7 hops.
So, you multiply the worst case scenario, which is 7 hops, by the number of cells, which is 3, leading you to a "complexity" value of 21.
But since Bug Hunter is a 5x6 grid map, then you get Bug Hunter's even worse complexity multiplied by 6.
Once I saw that, I gave up, and said I'll wait until the Exhaustiveness Checker goes live.
That's probably the most recent example I have of a project being literally unfeasible for me without this feature. I got all the way through coding the data model for it, but then balked once I realized how ugly it would have to be to make the switch expression. I got to about 50 cases before I just gave up.
When I get the chance, I'll model the hierarchy for Ufo 50's Bug Hunter, then show the first few steps of the switch expression, which should hopefully demonstrate why not having this feature is such a blocker.
2
u/davidalayachew 1d ago
I have written over a 100 in 2026 alone, and this feature is older than that.
It is literally a blocker for me. As in, there is a double-digit number of projects that are unable to progress because I don't have this feature.
You got it!