~/talk

Introduction to code generation with scalameta

Talkat Scala Days Copenhagen 2017 · 2017-05-30..06-02· [developer-experience]
slides:none on file

Live demo builds a macro that generates a companion with a working toMap/fromMap pair for any case class and the produced code compiles and runs in the example. It uses scalameta and quasiquotes, preserves existing companions, handles type parameters, optional and default fields, and prints generated code for debugging. The author extracted the work into scalameta-serialiser on GitHub, notes partial IDE support and that the approach targets Scala JVM/JS/Native (Android too), and argues scalameta is simpler and more maintainable than old macros.

AI-written summary · about

  1. 0:00Start
  2. 1:47objective for this talk
  3. 4:06metaprogramming • code that manipulates code
  4. 8:44feature code generation
  5. 9:43wiring macro with inline/meta
  6. 14:52construct and deconstruct ADT using quasiquotes
  7. 34:43passing values to annotation
  8. 39:27final thoughts • great metaprogramming DSL
~/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.