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

Documenting Base methods with doc macro clobbers their help entries #10482

Closed
mbauman opened this issue Mar 12, 2015 · 4 comments
Closed

Documenting Base methods with doc macro clobbers their help entries #10482

mbauman opened this issue Mar 12, 2015 · 4 comments
Assignees
Labels
docs This change adds or pertains to documentation

Comments

@mbauman
Copy link
Member

mbauman commented Mar 12, 2015

It'd be nice to show both the extended @doc documentation and the old helpdb.jl entry. This would allow package authors to document their extensions to base methods, and it'd start paving the way towards documenting base methods inline.

Trivial example:

help?> +
search: + .+

Base.+(x, y...)

   Addition operator. "x+y+z+..." calls this function with all
   arguments, i.e. "+(x, y, z, ...)".

julia> @doc "Foo!" -> +(::Foo) = Foo()
+ (generic function with 141 methods)

help?> +
search: + .+

  Foo!

julia>
@mbauman mbauman added the docs This change adds or pertains to documentation label Mar 12, 2015
@hayd
Copy link
Member

hayd commented Mar 12, 2015

This was also an issue when I tried to extract the docstrings as markdown from the rst docs (which I attempted in this commit) hayd@246314b see discussion in MichaelHatherly/Lexicon.jl#6.

This required a way to attach the help to a signature (e.g. Foo in your example) after definition-time, IIRC that was the thing holding that effort back (as well as nice syntax for it). I was hoping something like:

@doc """For ordered, indexable collections, the maximum index `i` for which `getindex(collection, i)` is valid. For unordered collections, the number of elements.
""" length(collection) -> Integer

@doc """Returns an array containing only the unique elements of the iterable `itr`, in the order that the first of each set of equivalent elements originally appears. If `dim` is specified, returns unique regions of the array `itr` along `dim`.
""" unique(itr[, dim])

cc @one-more-minute @MichaelHatherly.

@MikeInnes MikeInnes self-assigned this Mar 12, 2015
@MikeInnes
Copy link
Member

I can take a look at doing this but it depends on how much complexity it adds to the new doc code. Moving away from helpdb should be higher priority than being compatible with it IMO.

@mbauman
Copy link
Member Author

mbauman commented Mar 14, 2015

Yeah, I took a quick glance myself before I posted the issue. The fallback behaviors make this trickier than I imagined it would be. I had initially thought that this would block a migration away from helpdb, but that's not really true since the only sensible way to do it would be by moving whole functions at a time. It's not really worth spending time on.

@MikeInnes
Copy link
Member

This will be taken care of by #11828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

No branches or pull requests

3 participants