-
-
Save stephanos/3922811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import language.experimental.macros | |
import scala.reflect.makro.Context | |
object MacroSample { | |
def compiledTime(): String = macro compiledTime_impl | |
def compiledTime_impl(c: Context)(): c.Expr[String] = { | |
import c.mirror._ | |
import c.reify | |
val date = Expr(Literal(Constant(new java.util.Date().toString))) | |
reify("Compiled Time: " + date.eval) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment