Type Clash: When Structural and Nominal Systems Collide
summary
Compares concrete examples: a TypeScript query DSL that computes result types from select/where expressions and rejects invalid field operations at compile time, and a Kotlin compile-time FSM that encodes order states and two-step approvals so illegal transitions never compile; both demos compile and behave as claimed. Claims that structural typing wins for type-level computation and dynamic type construction (API integration, ad-hoc composition), while nominal typing wins for identity, semantic safety, and refactor-safe invariants enforced by the compiler.
AI-written summary · about
chapters (8)
- 0:00Structural vs nominal types
- 4:37Structural type systems
- 9:39Nominal type systems
- 15:00Trade-offs between systems
- 16:05Structural typing in queries
- 23:54Nominal typing for FSMs
- 32:11Key takeaways
- 35:21Q&A
related talks
38mUnderstanding TypeScript's Structural Type System
49mThe Trouble With Types
38mScalaJS and Typescript: an unlikely romance
38mType Systems - The Good, Bad and Ugly
47mHistory and Philosophy of types
22mSubtyping is Overrated
01h 05mBusy TypeScript Developer’s Guide to Advanced TypeScript
01h 01mDeconstructing TypeScript’s Type System
