Skip to content

scrapping an arguable joke in the macro guide #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion overviews/macros/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ It's customary to import `c.universe._`, because it includes a lot of routinely
First of all, the macro needs to parse the provided format string.
Macros run during the compile-time, so they operate on trees, not on values.
This means that the format parameter of the `printf` macro will be a compile-time literal, not an object of type `java.lang.String`.
This also means that the code below won't work for `printf(get_format(), ...)`, because in that case `format` won't be a string literal, but rather an AST that represents a function application. Adjusting the macro to work for arbitrary expressions is left as an exercise for the reader.
This also means that the code below won't work for `printf(get_format(), ...)`, because in that case `format` won't be a string literal, but rather an AST that represents a function application.

val Literal(Constant(s_format: String)) = format.tree

Expand Down