This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: make (oop goops describe) show docstrings


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]