-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Simplify function signature insertion in docsystem ? #13504
Comments
See also #9838. Unfortunately I'm not sure it (yet?) makes sense attaching to a specific method, for one thing there's syntax to attach it to the function (which doesn't have a unique signature). The current convention is you to write the docstring as general as possible and write a faux-signature to match... but I agree that's far from ideal. cc @MichaelHatherly I suspect this came up in Docile! It would be nice to get that [] syntax from |
Also agree, having docs going out of sync isn't great. I have got a basic prototype of the placeholder idea going in https://github.com/MichaelHatherly/Docile.jl/tree/rewrite where signatures are automatically captured in a variable """
$doc!sig
...
"""
f(x) = ... The trouble I've run into is how much a signature should be simplified, or whether it should be simplified at all. Other than that I've found this approach to work quite well so far. |
I like Alternate proposal: "Add the signature" is a better default than "Don't add it". The signature could be automatically added to the docstring for method definitions (like """ Returns the first element of a collection """ # signature added
first(x) = x[1]
"""
abs(x)
The absolute value of x.
"""
function abs end
@doc """
... Signature not added here
""" foo(x) = ... |
I should have probably linked to DocStringExtensions.jl here when I initially registered it, which implements the |
Hi,
I've been following docsystem from far away and got a chance to try master in the last few days.
I must say that the new doc system is great, I have questions & proposals I search a bit if thiswas proposed but did not find reference to it anywhere.
It seem to me that when writing doc for a function you have to re-include the signature manually.
Out of experience in javascript, and Python a bit too, this get cumbersome and often quickly out of sync.
Did you thought about inserting the function/methods signature Automatically ? I guess yes, but there are edge-cases where you might not want the function signature. Would it be possible to have a placeholder like
{{signatures}}
that would be replace by the signature(s) of the function(s) or representation of object(s) the doc is attached to ? That would make docs easier to write.Typical example from #12703
(note that doc is imprecise and miss merge and pull arguments)
would become
The text was updated successfully, but these errors were encountered: