(macroCompiler: StringAdd[MacroCompiler]).+(other)
(macroCompiler: StringAdd[MacroCompiler]).+(other)
(macroCompiler: ArrowAssoc[MacroCompiler]).->(y)
(macroCompiler: ArrowAssoc[MacroCompiler]).->(y)
(macroCompiler: Ensuring[MacroCompiler]).ensuring(cond, msg)
(macroCompiler: Ensuring[MacroCompiler]).ensuring(cond)
(macroCompiler: Ensuring[MacroCompiler]).ensuring(cond, msg)
(macroCompiler: Ensuring[MacroCompiler]).ensuring(cond)
(macroCompiler: Ensuring[MacroCompiler]).ensuring(cond, msg)
(macroCompiler: Ensuring[MacroCompiler]).ensuring(cond)
(macroCompiler: Ensuring[MacroCompiler]).ensuring(cond, msg)
(macroCompiler: Ensuring[MacroCompiler]).ensuring(cond)
Returns string formatted according to given format string.
Returns string formatted according to given format string.
Format strings are as for String.format
(@see java.lang.String.format).
(macroCompiler: StringFormat[MacroCompiler]).formatted(fmtstr)
Returns string formatted according to given format string.
Returns string formatted according to given format string.
Format strings are as for String.format
(@see java.lang.String.format).
(macroCompiler: StringFormat[MacroCompiler]).formatted(fmtstr)
(macroCompiler: ArrowAssoc[MacroCompiler]).→(y)
(macroCompiler: ArrowAssoc[MacroCompiler]).→(y)
Type class which abstracts compilation of macro defs.
Previously macro defs were linked to macro impls using hardcoded logic in Macros.scala. This logic took the right-hand side of a macro def, typechecked it as a reference to a static method and then used that method as a corresponding macro implementation.
Now compilation of macro defs is fully extensible. Instead of using a hardcoded implementation to look up macro impls, the macro engine performs an implicit search of a MacroCompiler in scope and then invokes its
resolveMacroImplmethod, passing it the DefDef of a macro def and expecting a reference to a static method in return. Of course,resolveMacroImplshould itself be a macro, namely an untyped one, for this to work.Default instance of the type class,
Predef.DefaultMacroCompiler, implements formerly hardcoded typechecking logic. Alternative implementations could for instance provide lightweight syntax for macro defs, generation macro impls on-the-fly using c.introduceToplevel.