THE FOLD / GLITCH / HEISENBUG / THE STRUCTURAL TYPING
THE STRUCTURAL TYPING
a difference that does not exist in the data
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Two records with the same fields of the same types — are they the same type? Structural typing says yes. Nominal typing says they are whatever you named them, and that refusal is the entire feature.
LIT verified live. 4 record types, all 16 ordered pairs tested. Nominal accepts 4 — each type and itself. Structural accepts 6. The 2 extra are Point -> Vector and Vector -> Point, which have identical fields and different names. Structural never rejects anything nominal accepts; it only ever adds.
LIT verified live. 4 record types, all 16 ordered pairs tested. Nominal accepts 4 — each type and itself. Structural accepts 6. The 2 extra are Point -> Vector and Vector -> Point, which have identical fields and different names. Structural never rejects anything nominal accepts; it only ever adds.
2 HOW IT WAS WEAVED · AI + HUMAN
TypeScript and Go are structural, Java and Rust are nominal, and OCaml has both depending on which construct you reach for.
AVAN (AI) tested all 16 ordered pairs rather than arguing the case, because the containment is the finding: structural accepts a strict superset. The question is never which is more permissive — it is whether those 2 extra assignments are a convenience or a bug, and the type system cannot tell you.
AVAN (AI) tested all 16 ordered pairs rather than arguing the case, because the containment is the finding: structural accepts a strict superset. The question is never which is more permissive — it is whether those 2 extra assignments are a convenience or a bug, and the type system cannot tell you.
3 ONE DIMENSION
Sixteen pairs, two rules.
4 TWO DIMENSIONS · INTERACTIVE
Pick a pair and ask both rules.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the same shape, two names.
AVAN’s addition (the inverse-companion): the forward reading is that structural typing is more flexible. The inverse is that a name is a claim the compiler cannot check and that is why it is worth having. Point and Vector have identical fields and mean different things; no amount of inspecting
x and y will ever reveal that one is a position and the other a displacement. Read backwards, nominal typing is the type system agreeing to enforce a distinction it has no evidence for, purely because someone asserted it — which is the only mechanism available for a difference that does not exist in the data.LIT 4 record types across all 16 ordered pairs give nominal 4 accepts - each type and itself - against structural 6, where the 2 extra are Point -> Vector and Vector -> Point, which have identical fields and different names, and structural never rejects anything nominal accepts so it only ever adds
FIG TypeScript and Go are structural, Java and Rust are nominal, and OCaml has both depending on which construct you reach for. AVAN tested all 16 ordered pairs rather than arguing the case, because the containment is the finding: structural accepts a strict superset. The question is never which is more permissive - it is whether those 2 extra assignments are a convenience or a bug, and the type system cannot tell you.
FIG TypeScript and Go are structural, Java and Rust are nominal, and OCaml has both depending on which construct you reach for. AVAN tested all 16 ordered pairs rather than arguing the case, because the containment is the finding: structural accepts a strict superset. The question is never which is more permissive - it is whether those 2 extra assignments are a convenience or a bug, and the type system cannot tell you.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of HEISENBUG · David Lee Wise (ROOT0), with AVAN