JavaScript Doesn't Support Operator Overloading... Right?
summary
Claims a practical operator-overload layer for TypeScript that keeps full type inference and normal JS ergonomics by applying surgical, procedural patches to the TypeScript compiler and emitting transformed runtime code. Implementation uses a compile-time transform plus a patched typechecker, a symbol-based overloads API and scope directives like use GPU, and already runs in production inside TypeGPU (slides built with it) and is adopted by Typenet. The trade-off is a maintained patch pipeline rather than changing JS itself.
AI-written summary · about
chapters (21)
- 0:00Welcome and introduction
- 2:54TypeGPU and its uses
- 5:41Requirements for operator overloading
- 7:06History of operator overloading in JS
- 10:37Why standards rejected operator overloading
- 11:00Community solutions for operator overloading
- 13:26Limitations of JS abuse methods
- 14:27Bit packing vectors into numbers
- 15:28Global state and per-component operations
- 17:54Operand recording technique
- 19:43Code transformation approaches
- 22:31Function toString and AST parsing
- 24:40Code rewrite challenges and side effects
- 25:23Taichi JS and TypeScript limitations
- 27:09Adobe ExtendScript and AssemblyScript
- 28:50Introducing TSOver solution
- 31:58How TSOver works under the hood
- 32:41Maintaining TSOver fork
- 33:23Ecosystem adoption of TSOver
- 34:26Typenet library example
- 35:07Closing remarks and call to action
