extract_metadata: Extract docstring and meta data from an anonymous function
Description
Currently the docstring must come first and the metadata list must come
second. Both must precede any other code in the function. These constraints
may be relaxed in the future.
an expression with an optional docstring as the first statement
env
Environment in which to search for functions
skip_name
Do not attempt to find function matching expressions of
type 'name'. If FALSE, then a function will by searched for with name
expr if expr is a name. This leads to expr being
evaluated, which raises errors outside the purview of Rmonad. For example,
extract_metadata(stop("dying")).
Value
a list of three elements, the expression with the docstring and
metadata removed, the docstring itself, and the metadata.
# NOT RUN {## extract metadata from a block expr <- substitute(
{
"this is the docstring"list(foo="this is meta data")
5 * 32 }
)
extract_metadata(expr)
# }