Implement SIGNATURES-like abbreviation for collection of methods
setempler opened this issue · comments
When I have several methods, for example:
"""
$(SIGNATURES)
Print-fu.
"""
foo(x::Int) = print(x)
foo(x::Int, y::Int) = print(x + y)
I get
foo(x)
Print-fu.
But I am looking for an implementation that yields
foo(x)
foo(x, y)
Print-fu.
Is this possible at all?
Sorry, I must have missed this originally.
Docstrings are, in general, attached to a particular method, and hence $(SIGNATURES)
should only contain that method I think. But perhaps we could have $(SIGNATURES)
expand to all signatures when attached to a function declaration function foo end
. So for your use case it would look something like:
"""
$(SIGNATURES)
Print-fu.
"""
function foo end
foo(x::Int) = print(x)
foo(x::Int, y::Int) = print(x + y)
I don't think I will have time to look into this myself any time soon though, but a PR would be most welcome if someone wants to take a stab at implementing it.