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

(help some-procedure) may not work sometimes #291

Open
jpellegrini opened this issue Nov 24, 2021 · 2 comments
Open

(help some-procedure) may not work sometimes #291

jpellegrini opened this issue Nov 24, 2021 · 2 comments

Comments

@jpellegrini
Copy link
Contributor

(help some-procedure) may not work sometimes:

stklos> (help string-split)                       ;; <== it's the procedure object
No help for #[closure 7fa227af1320]

stklos> (help 'string-split)                      ;; <== it's the symbol (procedure name)
Help for string-split:
Documentation:
  (string-split str)
  (string-split str delimiters)
  parses |string| and returns a list of tokens ended by a character of the
  |delimiters| string. If |delimiters| is omitted, it defaults to a string
  containing a space, a tabulation and a newline characters.
  
  (string-split "/usr/local/bin" "/")
                         => ("usr" "local" "bin")
  (string-split "once   upon a time")
                         => ("once" "upon" "a" "time")

But with read-line, both (help read-line), without quoting and (help 'read-line) work.

Why?

Also, a bit confusing:

stklos> (define (f) "a" 1)
;; f
stklos> (help f)
Help for f:
Documentation:
  a
stklos> (help 'f)
No help for f
@jpellegrini
Copy link
Contributor Author

jpellegrini commented Nov 24, 2021

I think I know.

  1. is because the documentation is in the source, but not embedded in the procedure itself. I suppose this can't be fixed except by turning help into a macro that checks for both obj and 'obj... But that would be ugly.
  2. is because the documentation is in the procedure... But this is easy to fix: if there's no documentation for the symbol, then eval it and see if the object has documentation. No?

@jpellegrini
Copy link
Contributor Author

Hm, also:

stklos> (define-method f () "a" 1)
;; f
stklos> (help f)
No help for #[<generic> f (1)]
stklos> (help 'f)
No help for f
stklos> (define-generic f :documentation "a")
;; f
stklos> (help 'f)
No help for f
stklos> (help f)
No help for #[<generic> f (1)]

egallesio added a commit that referenced this issue Nov 20, 2023
This should close Issue #291.
egallesio added a commit that referenced this issue Nov 20, 2023
Thus, parameters can be passed to help, with or without quote.
This should close the (very old) issue #291
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

No branches or pull requests

1 participant