Functions or macros?
To misquote the Bard: to macrotize or not to macrotize? That is the question.
Most of the material in this section has been very much under the hood, explaining how metaprogramming in Julia works and how this leads to the ability to write genuine runtime macros.
If you are new to developing macros, you might find it overwhelming. One question you may well be asking is whether you can achieve everything you wish by using conventional functions rather than resorting to solutions involving macros, and the answer is mainly: yes!
It is possible, albeit somewhat simplistically, to distinguish between a couple of different types of macros.
The first are the ones we have met already, which are wrappers around some relatively trivial boilerplate code in order to save having to repeat that coding. These are (among others) the display macros such as @assert
, @print
, @show
, and so on, and the timing macros such as @time
, @benchmark
, and @btime
.
The latter couple...