是否有宏可以在运行时查看我的代码?
Is there a macros to see my code in runtime?
出于调试目的,我想打印传递的参数,例如
def myfunc(arg: MyType) = println(str_macro(arg) + " = " + arg)
我知道,I can define mine own。但是,这件事似乎是标准的。是否由标准库提供?
我认为标准库中没有,但请参阅 https://github.com/adamw/scala-macro-debug and https://github.com/vn971/macro-format (you can also do show(reify(arg).tree)
)。请注意,在这种情况下,如 0__ 所说,arg
的代码将只是 arg
!
出于调试目的,我想打印传递的参数,例如
def myfunc(arg: MyType) = println(str_macro(arg) + " = " + arg)
我知道,I can define mine own。但是,这件事似乎是标准的。是否由标准库提供?
我认为标准库中没有,但请参阅 https://github.com/adamw/scala-macro-debug and https://github.com/vn971/macro-format (you can also do show(reify(arg).tree)
)。请注意,在这种情况下,如 0__ 所说,arg
的代码将只是 arg
!