[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
setting arglist / doc-strings
- Subject: setting arglist / doc-strings
- From: hivnort@cobb.cs.rpi.edu (Todd Hivnor)
- Date: 28 May 1993 16:22:43 GMT
I developed a macro which sets the arglist of a function,
so that when the user types the function name, the arglist
appears on the bottom of the Listener window. It will also
send the function's name, arglist, and doc-string out on an
output stream. The latter functionality enables me to quickly
produce an up-to-date function listing, and avoid the
problems inherent in maintaining documentation separate from
the code. The code is:
(defmacro defunky (name lambda-list &optional doc-string
&rest body)
(setf (arglist name) lambda-list)
(format *doc-stream* "~a~%~a~%"
(cons name lambda-list)
(if (stringp doc-string) ;Is this really a doc-string?
(format nil "~a~%" doc-string)
"")) ; No, don't send it
`(defun ,name ,lambda-list ,doc-string ,@body)
)
This will not allow declarations to precede the doc-string,
as defun will do, but otherwise it should be functionally
equivalent. There is a related macro, called defmacroid,
which is identical to defunky, except for the call to defun,
which is replaced by a call to defmacro.
My questions are:
1) Will MCL still be able to compile (effectively) my
functions defined via defunky? (and macros via defmacroid)
2) Is there a means to add my doc-strings to MCL's on-line
documentation system?
3) I put defunky in the :CCL package, so that anybody can get
at it. I assume that's poor practice, but figured as long
as I keep the number of symbols added to :CCL minimal, I
should be OK. Opinions?
4) Wouldn't it be neat if MCL set the arglist to the actual
lambda-list, instead of (arg1 arg2 ..)
5) Wouldn't it be neat if MCL actually kept the doc-string,
so could interate over all exported symbols, spitting out
documentation & arglist for every function?
Comp. Sci. & Philosophy Q: AI : VR :: Mind : Body ?
hivnort@cs.rpi.edu A: F**k Descartes !
--
Q: AI : VR :: Mind : Body ?
hivnort@cs.rpi.edu A: F**k Descartes !