This is the home page of the project Kepler, an ongoing effort towards bringing compile-time metaprogramming to Scala. Our flavor of macros is reminiscent of Lisp macros, adapted to incorporate type safety and rich syntax. Unlike infamous C/C++ preprocessor macros, Scala macros: 1) are written in full-fledged Scala, 2) work with expression trees, not with raw strings, 3) cannot change syntax of Scala.

Macros are functions that are called by the compiler during compilation. Within these functions the programmer has access to compiler APIs. For example, it is possible to generate, analyze and typecheck code. You can learn more about macros from documentation.

Macros are shipping with the official Scala compiler. Since 2.10.0 Scala includes macros that can be enabled with import language.experimental.macros on per-file basis or with -language:experimental.macros on per-compilation basis. Numerous commercial and research projects are already using macros.

Macros are good for code generation, static checks and domain-specific languages, which makes them a tool of choice for a multitude of real-world use cases. Scenarios that traditionally involve writing and maintaining boilerplate can be addressed with macros in a concise and maintainable way. Therefore we believe that macros are a valuable asset to the Scala programming language.