How to generate a "qualified Select" using Scala macros? -
I'm playing with Scala macros while reading the examples, I often look at patterns like this:
select (word name (word name ("scala"), termname ("some"), termname ("apply"))
Is there any way to express it more precisely, is quite active and repetitive? I'm looking like something: choose
("scala.Some.apply")
pay no attention to commenter [ed. Dry comic warning.]
Scala version 2.11.2 (Java HotSpot (TM) 64-bit server VM, Welcome to Java 1.8). Type them in the expression to evaluate them. Type: Support for more information> Scala & gt; Q "scala.Some (42)" res0: reflect.runtime.universe.Tree = scala.Some (42) scale & gt; ShowRaw (res0) res1: string = apply (identity (word name ("scala"), termname ("some"), list (little (constant (42)))) scale & gt; Select ShowRaw (q "scala.Some.apply") res2: string = (select (word name ("name" ("scala"), termname ("something"), termname ("apply")) scale & gt ShowaR (tq "scala.Some") res4: string = (resize); resia: string = select (identity (word name ("scala"), termname ("some") Typically, you use a qq to make a very complex expression document:
> Choose
// tq "scala.Some" val t = (identity (pronoun ("scala")), Rkarnam ( "a"))
Comments
Post a Comment