Best way to extend a type doc string

Pkg A defines some type Foo, and this includes the declaration of a document string.
Pkg B extends the functionality of Foo objects and wants to extend, not replace, the type’s docstring.

What’s a clean way to do this?

“it just works”

julia> module A
           """
           docstring in A
           """
           struct aa end
       end
Main.A

help?> Main.A.aa
  docstring in A


julia> module B
           using Main.A
           """
           docstring in B
           """
           Main.A.aa
       end
Main.B

help?> Main.A.aa
  docstring in A

  ───────────────────────────────────────────────────────────────────────────────────────────────────────

  docstring in B

Great. That answers the question that I posed!

But what if I want to do the extension in the same module. That does not “just work”, right?

It should just work, much like you can have separate docstring for each method and they all show up

It doesn’t seem to work:

"""
line 1
"""
struct Goo end

julia> @doc Goo   
  line 1

# now add post facto:
@doc """line2""" Goo

julia> @doc Goo
   line 2

“line 1” has been replaced.

What am I missing?

  1. a docstring is registered in the module where it is defined.
  2. only one docstring in a module is associated with a (function/type, signature) pair
    a. defining another one replaces the incumbent.
  3. a docstring for a bare type has a null signature (i.e., Union{})
    a. constructors can add new docstrings.