Duplicated function documentation

The documentation of a function with multiple methods is duplicated.

"""
doc of f
"""
f(m::AbstractMatrix) = g(m)
f(r::AbstractVector) = g(h(r))

searching for the doc of the function

help?> f

results in

  doc of f
  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  doc of f
1 Like

I can’t reproduce this, probably you have attached a docstring to something else called f in that same Julia session.

Note also that if you just want to attach the docstring to a function rather than a method you can do

"""
doc of f
"""
function f end

f(m::AbstractMatrix) = g(m)
f(r::AbstractVector) = g(h(r))

for example.

2 Likes

I don’t have another symbol with that name. But that does not matter, as your suggestion of adding an empty function solved the problem
Thanks