I must integrate some macros in a project which is using a cake-pattern. That pattern allowed us to avoid zillions of imports, among other advantages, so we would like to keep it. Now, we are facing a problem with some experimental macros we have been testing outside the trunk. First, let's show a dummy system named Cake:
trait APiece {
class A
}
trait BPiece { this: APiece =>
def aMacro(a: A): Unit = () /* macro ??? */
}
trait CPiece { this: APiece with BPiece =>
def aMacroInvoker = aMacro(new A)
}
class Cake { this: APiece with BPiece with CPiece => }
APiece defines a class, BPiece is supposed to be a macro which uses the APiece defined class, and finally, CPiece invokes the macro. I said that BPiece was supposed to be a macro since I was unable to code an implementation for it. I have tried several ways but I always crash with the following error:
"macro implementation must be in statically accessible object"
Reading the macros code one can guess that it is neccesary to enclose the macro in a static module. Is there any way to deploy a macro which uses the system structures?