There are plans of adding macros to Scala language, and I think they are 
already partially implemented:

https://docs.google.com/document/d/1O879Iz-567FzVb8kw6N5OBpei9dnbW0ZaT7-XNSa6Cs/edit?hl=en_US


>From the article:

<<
Here is a prototypical macro definition:

    def m(x: T): R = macro implRef

At first glance macro definitions are equivalent to normal function 
definitions, except for their body, which starts with the conditional keyword 
macro and is followed by a possibly qualified identifier that refers to a 
static macro implementation method.

If, during type-checking, the compiler encounters an application of the macro 
m(args), it will expand that application by invoking the corresponding macro 
implementation method, with the abstract-syntax trees of the argument 
expressions args as arguments. The result of the macro implementation is 
another abstract syntax tree, which will be inlined at the call site and will 
be type-checked in turn.
>>

Bye,
bearophile

Reply via email to