Sharing Is Caring - How to Let the Compiler Know What You're Thinking
summary
Claim: sharing intent with the compiler—via typed wrappers, phantom types, implicit rules, and compile-time macros—turns it from dumb gatekeeper into active verifier. Examples: small case-class wrappers stop the swapped-ID bug by making appId/postId distinct; phantom-typed HTML/JS/URL tracks tainted vs safe content so interpolation rejects unsafe inputs; implicits derive JSON writers for String/List/Option/Either automatically; macros validate regex literals at compile time and generate case-class JSON serializers but remain experimental and hazardous.
AI-written summary · about
chapters (18)
- 0:00Intro
- 3:50Communication
- 6:22Typed Wrappers
- 10:43Programming is Hard
- 11:54Language Wrappers
- 14:37Phantom Types
- 18:59Good Implicits
- 21:35What's in a Name?
- 22:39Show Me the Code
- 26:06Derivation Galore
- 27:32Implicit Techniques
- 28:37What are Macros?
- 29:44When to Use Macros?
- 31:29Compile-time Regular Expressions
- 35:26Case Class Writer
- 37:17The Writer Macro
- 41:00Macro Alternatives
- 42:01Summary
related talks
29mCompile-Time Social Coordination
29mType Inference Techniques: Implementation and Formalization, Better Together
25m"Compiler-Driven Development: Making Rust Work for You"
24mTreat the Compiler With Compassion
01h 02mHow to Hide C++ Implementation Details
22mScale By The Bay 2018 Unconference: Omer Van Kloeten
27mParsing, Compiling, and Static Metaprogramming
43mImplicit parameters, when to use them (or not)!
