# Docstring being replaced

**URL:** <https://discourse.julialang.org/t/docstring-being-replaced/122129>\
**Category:** General Usage\
**Tags:** question\
**Created:** [November 1, 2024, 1:11pm UTC](https://discourse.julialang.org/t/docstring-being-replaced/122129 "2024-11-01T13:11:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fmario](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fmario/32/209791_2.png) [@fmario](https://discourse.julialang.org/u/fmario)\
**Post date:** [November 1, 2024, 1:11pm UTC](https://discourse.julialang.org/t/docstring-being-replaced/122129/1 "2024-11-01T13:11:49Z")

</div>

I make the following module:

```julia
module Foo

export Bar

"""
    Bar

Struct bar docstring.

"""
struct Bar
    n::Int

    @doc """
        Bar(n::Int)

    Constructor docstring.

    """
    function Bar(n::Int)
        return new(n)
    end
end

end

```

When I ask for the documentation of `Bar` in the REPL, I get both the docstring for the struct as well as that for the constructor.

Now, if I overload function call by adding:

```julia
"""
    (b::Bar)(x::Int)

Do something.

"""
function (b::Bar)(x::Int)
    return b.n + x
end

```

then when I do `using Foo` I get a warning: Replacing docs for `Foo.Bar :: Tuple{Int64}` in module `Foo`. The docstring for the constructor is then replaced by the docstring for the function call operator.

How can I keep both docstrings?
