Binding docstring to struct field

I don’t know the underlying reason why, but observe in the REPL:

julia> struct B
           "b docstring"
            b::Int64
       end;

help?> B.b
  B has fields b.

while

julia> "Module B"
        struct B
           "b docstring"
            b::Int64
       end

help?> B.b
  b docstring

So it seems it’s not include versus REPL, but the use of a docstring for the module definition.

You can “see” the docstring registration via Docs.meta(Main).

Actually, possibly related to an open issue (from 2016):
docstrings for inner constructors are ignored · Issue #16730 · JuliaLang/julia · GitHub

2 Likes