Not just that. ""
is a literal and in general, any expressions could be interpolated some will need ()
.
Any value can take place of a
in $a
, including "..."
. This is not a separate construct. I prefer $("...")
though for readability, but ()
s are optional.
Thank all of you! I learned (which are not in the documentation):
- Interpolation of expressions sometimes does not need parentheses, other times it does.
- esc() can occur anywhere in a macro, not just in the context of a return expression.
- Macros are more tricky than what you expect.
I try to rememberâŚ
This is open source, and open source only improves through the work of its contributors. The single most effective thing you can do to make Juliaâs macro documentation better is to open a pull request with suggestions for changes or improvements. The only barrier to being a contributor to Julia itself is the willingness to do so.
There was a workshop titled âA Practical Introduction to Metaprogramming in Juliaâ At this yearâs JuliaCon. Find it on YouTube at:
I havenât watched it (itâs on my to-do list) so I canât vouch for its quality but it might be a good resource that compliments the manual.
Actually it doesnât talk about macros at all but is well worth watching for its insights into how Julia operates behind the scenes.