Nominal Types in WebAssembly
6 days ago
- #Type Systems
- #Nominal Typing
- #WebAssembly
- WebAssembly initially used structural type equality, where types with the same structure are considered equivalent.
- Recursive type groups (`rec`) allow for nominal typing within a module by isolating types in their own equivalence classes.
- The nominal typing proposal introduces `tag` for defining nominal types, but lacks subtyping and mutability.
- Creating and checking nominal types involves exception handling mechanisms (`throw`, `try_table`, `catch`).
- Nominal types can be shared between modules via type imports and exports.
- The post humorously highlights the quirks of the nominal typing proposal in WebAssembly.