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

Add signatures to docstring examples in the manual #19646

Merged
merged 1 commit into from
Dec 21, 2016
Merged

Conversation

nalimilan
Copy link
Member

These examples did not follow the guidelines given in the rest
of the page. Also mark a few code blocks as being Julia code.

Multiplication operator. `x*y*z*...` calls this function with multiple
arguments, i.e. `*(x,y,z...)`.
"""
function *(x, y)
function *(x, y, z...)
# ... [implementation sold separately] ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 space indent these bodies while at it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Member

@Sacha0 Sacha0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps retain one example of the single-line "... docstring here..." syntax? Best!

@nalimilan
Copy link
Member Author

Perhaps retain one example of the single-line "... docstring here..." syntax? Best!

What for? We don't recommend it, so it sounds confusing to show it in the manual. I guess we will add an example of it when it will be possible to document a type's field (that DocStringExtensions currently supports).

@Sacha0
Copy link
Member

Sacha0 commented Dec 19, 2016

What for? We don't recommend it

It is useful? (For example for compact internal documentation?) Why do we not recommend it? Thanks!

@nalimilan
Copy link
Member Author

Not sure. Indeed it can be used for internal documentation, but if you add internal docstrings why not add the signature while you're at it?

@Sacha0
Copy link
Member

Sacha0 commented Dec 19, 2016

why not add the signature while you're at it?

I use " ... " only when I expect the docstring will (primarily) be read alongside the code, for example in place of a single-line comment describing a magical underscore method. In that case duplicating the signature in the docstring seems unnecessary and expands the code by at least a few lines.

Perhaps I should just use a single-line comment instead? Please let me know if so, and kindly ignore this suggestion. Thanks!

@MichaelHatherly
Copy link
Member

We don't really need handwritten signatures above every docstring now that we don't use genstdlib.jl; that was just a requirement for how it worked.

It is usually useful to have a signature, but there are cases, such as minor internal docs (as mentioned here) and docs that have a really straight forward signature (such as constants) that don't really need them. (Probably worth revisiting the guidelines once everyone has had one some to get used to the new system.)

@kshyatt kshyatt added domain:docs This change adds or pertains to documentation docsystem The documentation building system labels Dec 19, 2016
These examples did not follow the guidelines given in the rest
of the page. Also mark a few code blocks as being Julia code.
@nalimilan
Copy link
Member Author

Fair enough. I've kept the first one-liner. The confusion which prompted this PR was about the second example anyway, and the guidelines advise explicitly to always include the signature.

@nalimilan nalimilan merged commit cf060e2 into master Dec 21, 2016
@nalimilan nalimilan deleted the nl/docstrings branch December 21, 2016 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docsystem The documentation building system domain:docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants