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

peek docstring has a disconnect #54831

Open
GunnarFarneback opened this issue Jun 17, 2024 · 2 comments
Open

peek docstring has a disconnect #54831

GunnarFarneback opened this issue Jun 17, 2024 · 2 comments
Labels
domain:docs This change adds or pertains to documentation

Comments

@GunnarFarneback
Copy link
Contributor

This is the peek docstring:

help?> peek
search: peek seek

  peek(stream[, T=UInt8])

  Read and return a value of type T from a stream without advancing the current position in the stream. See
  also startswith(stream, char_or_string).

  Examples
  ≡≡≡≡≡≡≡≡

  julia> b = IOBuffer("julia");
  
  julia> peek(b)
  0x6a
  
  julia> position(b)
  0
  
  julia> peek(b, Char)
  'j': ASCII/Unicode U+006A (category Ll: Letter, lowercase)

  │ Julia 1.5
  │
  │  The method which accepts a type requires Julia 1.5 or later.

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

  peek(stream [, n=1]; skip_newlines=false)

  Look ahead in the stream n tokens, returning the token kind. Comments and non-newline whitespace are
  skipped automatically. Whitespace containing a single newline is returned as kind K"NewlineWs" unless
  skip_newlines is true.

The last method initially looks like it's a variation of the first, but then the explanation stops making sense and at closer investigation it turns out to document a peek(::Base.JuliaSyntax.ParseStream) method. This is quite confusing but I guess the bigger question is whether JuliaSyntax should add methods to Base.peek in the first place.

@Seelengrab
Copy link
Contributor

If nothing else, JuliaSyntax should have ::JuliaSyntax.ParseStream in its docstring of peek, so that it can't be confused with a more generic method.

@Seelengrab Seelengrab added the domain:docs This change adds or pertains to documentation label Jun 17, 2024
@jakobnissen
Copy link
Contributor

See also #54749

Octogonapus added a commit to Octogonapus/julia that referenced this issue Jul 15, 2024
Octogonapus added a commit to Octogonapus/julia that referenced this issue Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation
Projects
None yet
Development

No branches or pull requests

3 participants