Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SIGNATURES-like abbreviation for collection of methods #56

Open
setempler opened this issue Mar 24, 2018 · 1 comment
Open

Comments

@setempler
Copy link

setempler commented Mar 24, 2018

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?

@mortenpi
Copy link
Member

mortenpi commented Jul 1, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants