On Thu, Oct 6, 2016 at 2:19 AM, Sébastien Celles <[email protected]> wrote: > Hello, > > In this SO question > http://stackoverflow.com/questions/36191766/metaprogramming-within-docstring-with-eval/36209841#36209841 > > the following code > > for (f, name) in ((:add, "addition"), (:sub, "subtraction")) > @eval begin > @doc """ > This is the function $($name) > """ > function $f() > ## FUNCTION BODY > end > end > end > > > works with Julia 0.4
It doesn't. You are not adding any doc string on the function. > but raises ERROR: LoadError: Invalid @var syntax 'This > is the function ' > with Julia 0.5 > > I noticed that it can be fixed for Julia 0.5 adding -> > > > for (f, name) in ((:add, "addition"), (:sub, "subtraction")) > @eval begin > @doc """ > This is the function $($name) > """ -> > function $f() > ## FUNCTION BODY > end > end > end > > > What is exactly the goal of -> with @doc macro ? > > Why is it necessary with Julia 0.5 and not with Julia 0.4 ? > > > Kind regards
