Pattern Matching
summary
Proposes encoding deconstructors as class members implemented as method handle tuples so common cases (instanceof + field access) are allocation free and inline like handwritten code, with more complex matches using a hidden carrier state for one-word precomputation. Uses a constant_dynamic bootstrap to link pattern constants and composable combinators, and a selector via invokeDynamic that yields an int for O(1) switch dispatch. Discusses composition, separate compilation and binary-compatibility tradeoffs and migration paths.
AI-written summary · about
chapters (18)
- 0:00Intro
- 0:20Pattern Matching
- 9:02Example: Evaluating Expressions
- 12:37Use-site polymorphism
- 14:54What's Going On?
- 17:10Language Feature, or VM Feature?
- 19:29Are Patterns Methods?
- 22:03A Compiler Writers Wish List
- 22:52Fetch Me My Magic Hammer
- 24:34Performance Goals
- 26:10Intermediate Carriers
- 27:38A Strawman
- 29:24Invoking Dtors
- 33:10Composing Dtors
- 35:54Translating Pattern Switch
- 38:55Binary Compatibility
- 40:04Summary
- 46:02Example: Simplifying Expressions
related talks
22mPattern Matching
39mPattern Matching: Small Enhancement or Major Feature?
52mPattern Matching: Small Enhancement or Major Feature?
38mPattern Matching in Java: Better Code, Better APIs
54mPattern Matching in Java: Past, Present, Future
50mPattern Matching in Java Deep Dive
29mThe Art of Java Language Pattern Matching
56mThe Art of Java Language Pattern Matching
