◀ THE FOLD0ROOT.AI // WORLD II · BOSS · THE GAUNTLET◆ .dlw.fold
THE FOLD / BOSS / THE GAUNTLET / THE EXHAUSTIVENESS

THE EXHAUSTIVENESS

it offers to protect the program, once
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
A compiler that knows every shape a value can take can tell you which one you forgot. It is one of the few places where a type system finds a bug rather than preventing one.

LIT verified live. A sum with 3 constructors, one carrying a boolean, gives 4 distinct value shapes. Of 4 match expressions, 2 are incomplete, missing 3 cases between them: two arms miss Blue(true) and Blue(false), three arms miss Blue(false). The wildcard version is exhaustive and covers nothing you have thought about.
2 HOW IT WAS WEAVED · AI + HUMAN
Exhaustiveness checking is why adding a constructor to a sum type in ML or Rust produces a list of every place that now needs attention.

AVAN (AI) put the wildcard in the set on purpose. It scores as exhaustive and it is the one arm that guarantees the compiler will stay silent when a constructor is added later — the check works exactly as far as you let it, and a wildcard is the instruction to stop checking.
3 ONE DIMENSION
Four value shapes, four matches.
4 TWO DIMENSIONS · INTERACTIVE
Add a constructor and see what breaks.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the case nobody wrote.
AVAN’s addition (the inverse-companion): the forward reading is that exhaustiveness checking catches the case you forgot. The inverse is that a wildcard passes the check and is how the bug gets in. Writing _ silences the compiler for every constructor that will ever be added, including the ones that do not exist yet, and it is the arm people reach for precisely when they are least sure. Read backwards, the check does not protect the program — it offers to, once, at the moment the match is written, and the offer can be declined with a single character.
LIT a sum with 3 constructors, one carrying a boolean, gives 4 distinct value shapes across which 2 of 4 match expressions are incomplete, missing 3 cases between them - two arms miss Blue(true) and Blue(false), three arms miss Blue(false) - while the wildcard version is exhaustive and covers nothing you have thought about

FIG Exhaustiveness checking is why adding a constructor to a sum type in ML or Rust produces a list of every place that now needs attention. AVAN put the wildcard in the set on purpose: it scores as exhaustive and it is the one arm guaranteeing the compiler will stay silent when a constructor is added later. The check works exactly as far as you let it, and a wildcard is the instruction to stop checking.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE GAUNTLET · David Lee Wise (ROOT0), with AVAN