Skip to content

Commit

Permalink
Merge pull request JuliaLang#8803 from maleadt/pr_meta_docs
Browse files Browse the repository at this point in the history
Update developer docs with push/popmeta! changes.
  • Loading branch information
timholy committed Oct 26, 2014
2 parents 528a137 + 870c132 commit ffebd6a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions doc/devdocs/meta.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ gets turned into an expression like this::
end
end

``pushmeta!(ex, :symbol)`` appends ``:symbol`` to the end of the
``:meta`` expression, creating a new ``:meta`` expression if
necessary.
``pushmeta!(ex, :symbol, args...)`` appends ``:symbol`` to the end of
the ``:meta`` expression, creating a new ``:meta`` expression if
necessary. If ``args`` is specified, a nested expression containing
``:symbol`` and these arguments is appended instead, which can be used
to specify additional information.

To use the metadata, you have to parse these ``:meta`` expressions.
If your implementation can be performed within Julia, ``popmeta!`` is
very handy: ``popmeta!(body, :symbol)`` will scan a function *body*
expression (one without the function signature) for a ``:meta``
expression; if ``:symbol`` is present, it will return ``true`` and
remove ``:symbol`` from the arguments of the ``:meta`` expression
(deleting the expression altogether if there are no more arguments).
expression, 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.

Not yet provided is a convenient infrastructure for parsing ``:meta``
expressions from C++.

0 comments on commit ffebd6a

Please sign in to comment.