Virtual ADTs for Portable Metaprogramming

by Nicolas Stucki, Jonathan Immanuel Brachthäuser, and Martin Odersky

In Proceedings of the 18th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes, pages 36–44. Association for Computing Machinery, 2021.

Abstract

Scala 3 provides a metaprogramming interface that represents the abstract syntax tree definitions using algebraic data types. To allow the compiler to freely evolve without breaking the metaprogramming interface, we present virtual algebraic data types (or Virtual ADTs) – a programming pattern, which allows programmers to describe mutually recursive hierarchies of types without coupling to a particular runtime representation.