~/talk

Interpreter Pattern In Light of Java 21

links:none on file
slides:none on file

Classic Interpreter bakes evaluation into mutable domain objects so changing interpretation forces edits and mixing of concerns; modern Java 21 split solves that by modeling expressions as a sealed hierarchy of records (Constant, Sum, Subtract, Multiply) and writing external interpreters implemented with sealed classes, pattern matching and switch expressions to produce evaluators that return values, pretty-printed strings, or asynchronous results via CompletableFuture. Examples show a runner evaluating RPN-style expressions, an async evaluator, and notes on bringing in monadic types like Either/Option and type-class-style flatMap to move map/flatMap outside the model.

AI-written summary · about

  1. 0:00Introduction to patterns
  2. 2:39The classic interpreter
  3. 12:17Modernizing the approach
  4. 19:25Sealed classes and pattern matching
  5. 25:40Advanced pattern matching
  6. 31:00Externalizing interpretations
  7. 37:11Functional concepts
  8. 43:00Scala and monadic patterns
  9. 53:58Future perspectives
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.