Use Scala macros to generate methods
问题 I want to generate aliases of methods using annotation macros in Scala 2.11+. I am not even sure that is even possible. If yes, how? Example - Given this below, I want the annotation macros to expand into class Socket { @alias(aliases = Seq("!", "ask", "read")) def load(n: Int): Seq[Byte] = {/* impl */} } I want the above to generate the synonym method stubs as follows: class Socket { def load(n: Int): Seq[Byte] = // .... def !(n: Int) = load(n) def ask(n: Int) = load(n) def read(n: Int) =