Talking to the compiler (the :meta mechanism))
:meta
expressions are created with macros. As an example, consider the implementation of the @inline
macro:
gets turned into an expression like this:
To use the metadata, you have to parse these :meta
expressions. If your implementation can be performed within Julia, Base.popmeta!
is very handy: will scan a function body expression (one without the function signature) for the first :meta
expression containing :symbol
, extract any arguments, and return a tuple (found::Bool, args::Array{Any})
. If the metadata did not have any arguments, or :symbol
was not found, the args
array will be empty.