I was hoping to generate several redundant docstrings using code
generation. Unfortunately I have run into an issue where $name isn't being
replaced in the docstring:
julia> using Base.Dates
julia> for name in (:year, :month, :day, :hour, :minute, :second, :
millisecond)
@eval begin
@doc """
$name(dt::TimeType) -> Int64
Return the $name of a `Date` or `DateTime` as an `Int64`.
""" ->
$name(dt::TimeType)
end
end
ERROR: UndefVarError: name not defined
in eval(::Module, ::Any) at ./boot.jl:267
[inlined code] from ./boot.jl:266
in anonymous at ./no file:4294967295
in eval(::Module, ::Any) at ./boot.jl:267
Is there a way I can get this to work?