Writing DSL for DSL: Catch Code as It's Born with TracePoint
summary
Typelizer extracts field types from serializer DSLs and emits TypeScript types or OpenAPI schemas, merging DB schema, ActiveRecord attributes and annotations. It originally uses TracePoint API to subscribe to method call events while requiring each serializer file, capturing bindings and local variables and storing type info during that short window. Because of special-case methods and overhead it later switches to module prepend for interception, while a type generation rake task enables tracing only briefly and filters aggressively.
AI-written summary · about
chapters (7)
- 0:00Introduction and welcome
- 3:20What is Typelizer and why it matters
- 8:20TracePoint API deep dive
- 12:14How Typelizer uses TracePoint
- 15:07TracePoint limitations and trade-offs
- 17:55When to avoid TracePoint
- 19:21Q&A and closing remarks
related talks
25mMore DSL, Less Pain
37mRuby ate my DSL!
38mDSLs, Code Generation, and New Domains for Ruby
36ms/regex/DSLs/: What Regex Teaches Us About DSL Design
40mAutomated Type Contracts Generation for Ruby
01h 10mDomain Specific Languages: Molding Ruby
32mCrafting elegant code with ruby DSLs
32mThe little schema that could (...but should it?)
