You also need to @eval
the call to @doc
.
Here is an MWE, based on your example:
fdocs = Dict(
:foo => "returns 1",
:bar => "returns 1 also"
# etc.
)
for (f, docstring) in fdocs
@eval $f() = 1
@eval @doc $docstring $f
end
help?> foo
search: foo floor pointer_from_objref OverflowError RoundFromZero unsafe_copyto!
returns 1
help?> bar
search: bar baremodule SubArray GlobalRef clipboard BitArray backtrace BitMatrix
returns 1 also