Semantics-Preserving Inlining for Metaprogramming
Inlining is used in many different ways in programming languages: some languages use it as a compiler-directive solely for optimization, some use it as a metaprogramming feature, and others lay their design in-between.
Can we disentangle inlining from the other metaprogramming features? Yes, and this is the approach followed in Scala 3 to support a powerful set of metaprogramming constructs. In a multi-paradigm language like Scala, the concern for generality of inlining poses several interesting questions. In this paper, we explore these questions by explaining the rationale behind the design of Scala-3’s inlining capability and how it relates to its metaprogramming architecture.