One Docstring for multiple Functions in Julia

Viewed 68

I have two functions

function foo() end
function bar() end

Is it possible as in R for example to write a single docstring for both functions?

1 Answers

You can define a string with the common docstring and interpolate it into the docstrings of your functions, e.g.

julia> docstr = "hello world!"
"hello world!"
julia> "$docstr"
       function foo() end
foo

help?> foo
search: foo floor pointer_from_objref OverflowError RoundFromZero unsafe_copyto! functionloc StackOverflowError

  hello world!

julia> "$docstr"
       function bar() end
bar

help?> bar
search: bar baremodule SubArray GlobalRef clipboard BitArray backtrace BitMatrix catch_backtrace AbstractRange

  hello world!
Related