[julia-users] Re: Creating docstrings using code generation

2016-03-03 Thread Michael Hatherly
The `eval` is going to do some really odd things there. If you're on a very recent 0.5 build you should probably see the following output after doing that ``` julia> for name in (:year, :month, :day, :hour, :minute, :second, :millisecond) func = eval(name) @doc """

[julia-users] Re: Creating docstrings using code generation

2016-03-03 Thread Curtis Vogt
Thanks Mike, I also managed to come up with an alternative solution: using Base.Dates for name in (:year, :month, :day, :hour, :minute, :second, :millisecond) func = eval(name) @doc """ $name(dt::TimeType) -> Int64 Return the $name of a `Date` or `DateTime` as an `Int64`.

[julia-users] Re: Creating docstrings using code generation

2016-03-03 Thread Michael Hatherly
Just needs extra `$`s in the docstring, one for expression interpolation and one for string interpolation: julia> for name in (:year, :month, :day, :hour, :minute, :second, : millisecond) @eval begin @doc """ $($name)(dt::TimeType) -> Int64