Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Last active June 14, 2019 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseoliv/7bd41c58f01cb01fc1544bf566570ecb to your computer and use it in GitHub Desktop.
Save joseoliv/7bd41c58f01cb01fc1544bf566570ecb to your computer and use it in GitHub Desktop.
printexpr
package metaobjectTest
@doc{*
Macro printexpr has the following syntax:
printexpr expr;
'printexpr' is a macro keyword and 'expr' is an expression. ';' should
end the macro call.
The macro call
var Int n = 9;
printexpr n + 1;
will print, at runtime,
'n + 1' == 10
*}
object Printexpr
func run {
var Int n = 9;
"""The following line should be, without the quotes, "'n + 1' == 10" """ println;
printexpr n + 1;
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment