This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: make (oop goops describe) show docstrings
- To: guile at sourceware dot cygnus dot com
- Subject: Re: make (oop goops describe) show docstrings
- From: Keisuke Nishida <kxn30 at po dot cwru dot edu>
- Date: 02 May 2000 01:34:07 -0400
- References: <87zoqdgvp7.fsf@PC486.Niemitalo.LAN> <m31z3p6zk5.fsf@kei.cwru.edu> <877ldgrc8y.fsf@PC486.Niemitalo.LAN> <m37ldgg0cw.fsf@kei.cwru.edu> <87hfcjvgkn.fsf_-_@PC486.Niemitalo.LAN>
Kalle Olavi Niemitalo <tosi@ees2.oulu.fi> writes:
> > I think we'd better modify the file goops/describe.scm so that it
> > merges ice-9/doc.scm, though I'm not sure if GOOPS supports docstrings.
>
> Methods can have them:
>
> guile> (define-method (fool x) "Return x" x)
> guile> (generic-function-methods fool)
> (#<<method> (<top>) 40310490>)
> guile> (procedure-documentation (method-procedure (car (generic-function-methods fool))))
> "Return x"
I see. I think it is great if we have a procedure `documentation'
which returns a docstring (instead of printing it) and a procedure
`describe' which prints a docstring in a readable format:
guile> (documentation acons)
"(acons key value alist)
Adds a new key-value pair to @var{alist}.
..."
guile> (describe acons)
`acons' is a primitive procedure defined in `alist.c'.
(acons KEY VALUE ALIST)
Adds a new key-value pair to ALIST.
...
guile> (describe fool)
`fool' is a generic function.
Method: (fool (X <top>))
Return X.
Method: (fool ...)
...
guile> (describe (car (generic-function-methods fool)))
`fool' is a method.
(fool (X <top>))
Return X.
...
We could control the output from describe by giving it parameters.
And then, we could redirect the output into an Emacs buffer, create
links (i.e., `alist.c' to the source file, "Method:" to a detailed
help), and display it.
I think these procedures can be placed in one file, but we could also
modify both (ice-9 doc) and (oop goops describe). What would be the best?
-- Kei