Skip to content

Update Base.peek docstring #440

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

Merged
merged 1 commit into from
Jun 18, 2024
Merged

Update Base.peek docstring #440

merged 1 commit into from
Jun 18, 2024

Conversation

nhz2
Copy link
Member

@nhz2 nhz2 commented Jun 16, 2024

When looking at the help for peek in the repl, the current docstring looks like it applies to all IO, so I added ::ParseStream to make the docstring more specific. See also JuliaLang/julia#54749

When looking at the help for `peek` in the repl, the current docstring looks like it applies to all `IO`, so I added `::ParseStream` to make it more specific. See also JuliaLang/julia#54749
Copy link

codecov bot commented Jun 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.83%. Comparing base (bd29025) to head (3dca95e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #440      +/-   ##
==========================================
- Coverage   96.17%   95.83%   -0.35%     
==========================================
  Files          14       13       -1     
  Lines        4185     3937     -248     
==========================================
- Hits         4025     3773     -252     
- Misses        160      164       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GunnarFarneback
Copy link

GunnarFarneback commented Jun 18, 2024

This makes it clear that it's not an IO method of peek but most Base users won't have any idea what a ParseStream is and that they need to look it up as Base.JuliaSyntax.ParseStream.

But I think the real problem here is that JuliaSyntax shouldn't add a method to Base.peek at all but use a module local function for its internal ParseStream peeking.

@KristofferC
Copy link
Member

Yes, either we remove the docstring or make it module local. No need for this to show in docs at all.

@pfitzseb
Copy link
Member

Both of those seem like bad options, no? Base.peek is the right concept, so an overload seems appropriate. Removing the docstring seems weird as well.

Can't we do this level of filtering in Documenter.jl instead?

@KristofferC
Copy link
Member

KristofferC commented Jun 18, 2024

Okay, how about detecting when the package is put into the sysimage and not add the docstring in that case?

Also, if peek is the right concept, why does it need a docstring? The generic one should do in that case? I don't add docstrings to all my getindex methods.

@pfitzseb
Copy link
Member

why does it need a docstring?

Because it has additional kwargs that should be documented.

Okay, how about detecting when the package is put into the sysimage and not add the docstring in that case?

Ok, so I think there are a few desirable properties for docstrings added by stdlibs:

  1. Documentation can be retrieved when the stdlib is loaded (by any mechanism, sysimg or no)
  2. stdlib docs are distinct enough from Base docs when viewed in the REPL (e.g. by printing the defining module)
  3. Documenter should separate/filter docstrings based on where they're defined (so the Base section only talks about Base methods)

Most of that holds for generic packages as well, and this PR is probably not the right place to talk about that anyways.


I think I'll just go ahead and merge this as-is, because it's an improvement. Further steps can be taken in a new PR.

@pfitzseb pfitzseb merged commit 3bf262b into JuliaLang:main Jun 18, 2024
@nsajko nsajko added the documentation Improvements or additions to documentation label Jun 18, 2024
@nhz2 nhz2 deleted the patch-1 branch June 18, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants