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 internal docs for metadata and array behind Extended help wrappers #694

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

felixcremer
Copy link
Contributor

This adds docstrings to internal functions in metadata and array which are hidden behind an Extended help layer. The idea is to provide the docstring, but to make clear that the functions are internal.
The docstrings could clearly be improved, they are based on my current understanding from reading the code.
If you like the overall look of this, I might be going through more of the internal functions in the next weeks to add more internal documentation.

I also added docstrings to DimVector and similar types following the docstring examples for AbstractVector.
In the REPL this would look like this for internal functions:

help?> DD._dimlength
  Internal function

  ─────────────────────────────────────────────────────────────────────────

Extended help is available with `??`

help?> ?DD._dimlength
  Internal function

  Extended help
  ≡≡≡≡≡≡≡≡≡≡≡≡≡

  _dimlength(dim)

  Return the length of the dimension dim or in case of a Tuple the length
  of every dimension in the Tuple.

src/array/array.jl Show resolved Hide resolved
src/array/array.jl Show resolved Hide resolved
src/array/array.jl Show resolved Hide resolved
src/array/array.jl Show resolved Hide resolved
@@ -96,6 +102,14 @@ end

# Metadata utils

"""
Internal function.
Copy link
Owner

Choose a reason for hiding this comment

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

Does "Internal function" do something or its just a marker?

I'm not used to adding this much documentation, don't we just want this as a code comment?

Copy link
Collaborator

@asinghvi17 asinghvi17 Nov 15, 2024

Choose a reason for hiding this comment

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

IMO this is very nice - when you see it in a stack trace, you can run ? on it and immediately see what it does. For people who are good at Julia, not 100% immersed in the DD world, and want to debug an error - this is priceless.

But the string itself is just a marker, there's no special treatment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am wondering, whether the marker "Internal function" is even needed nowadays, because with the public keyword, and the changes in Base handling of the show of non-public functions this is rather handled by Base.

@felixcremer
Copy link
Contributor Author

In Julia 1.11 the Internal function thing and the extended help is not needed anymore because it would look like this:

help?> ?DimensionalData._dimlength
  │ Warning
  │
  │  The following bindings may be internal; they may change or be removed in future versions:
  │
  │    •  DimensionalData._dimlength

  Internal function

  Extended help
  ≡≡≡≡≡≡≡≡≡≡≡≡≡

  _dimlength(dim)

  Return the length of the dimension dim or in case of a Tuple the length of every dimension in the Tuple.

The first part with the | signs in front is inserted from the REPL and the Warning is in yellow, so we could just add the docstring normally to the non-public functions.

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

Successfully merging this pull request may close these issues.

3 participants