Is there any way to access the docstring accompanying a macro at call place? It would be something like this:
macro MyMacro(arg)
# Do something with my docs
# It does not mean that I want to append the outer doc to some inner object using Main.@__doc__
end
"I want to access this docstring"
@MyMacro argument
Did you find an answer? I’d be interested in this too…
I tried to use a combination of @__doc__ and @doc, but that didn’t work, presumably due to scheduling issues. (The idea was to label a variable within the macro using @__doc__, so that the docstring is attached to this variable. Then, hypothetically, one could call@doc on the same variable to retrieve the docstring again. However, when doing so I always get “No documentation found” because the “binding variable does not exist”.)
Yes, I was able to advance a little bit further, though not much because my day job is taking all my time.
It gets super complicated, but the scheduling issue is solved calling Doc undocumented methods manually over the created object. The undocumented methods are a mess because they use as parameters undocumented features (IdDicts and more) and access module-level undocumented fields directly and such.
I’m on my phone so I can’t say much else, sorry
For posterity: In my case, the problem was that the macro I’m working on creates a struct that I wanted to be able to document. However, the struct has to be created inside a double quote, and therefore one can’t simply apply @__doc__ to it. However, one can subsequently simply apply @__doc__ to the symbol that names the new struct, thus obviating the need for any more fancy metaprorgamming.