upd. Macro paradise for 2.10 and 2.11 now features macro annotations that can implement the design that's discussed below.
The following excerpt from a development branch of LMS project illustrates a typical class of problems. Sometimes neither object-oriented, nor functional programming can overcome certain kinds of boilerplate:
As outlined in the "Type providers" case study, one of the solutions to the problem is textual code generation. Often, it's the most obvious and the only accessible one. The aforementioned case study dwells upon the shortcomings of this approach: 1) unintelligibility of generated code, 2) poor extensibility, 3) sub-par maintainability of code generators - and proposes a solution that involves macro types.
However, there are situations when generating a single type will not save the day. Sometimes the way to go is to create multiple types and/or functions at once.
We considered to introduce macro packages, but decided that macro types will be enough, since Scala
already represent an abstraction equivalent to packages (and even supercede them, because objects can be nested and, as of such, can capture values from the enclosing lexical scope).
There are plenty of other situations when convenient facilities for boilerplate generation may come in handy. Just off the top of my head: enums, serialization/deserialization, lenses, zippers and so on.