[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

suggestion for the future.

    Date: Thursday, 5 January 1984  21:00-EST
    To:   common-lisp at SU-AI.ARPA
    Re:   A nit and a suggestion for the future.

    ...A suggestion for future enhancements to DEFSTRUCT.  There is no way
    to attach doc strings to anything but the structure itself.  I can't
    hang a doc string on the accessors, SETF forms, print function, copier,
    etc.  I'm afraid DEFSTRUCT needs a host of additional options.

I think that documenting the slots themselves, as opposed to documenting
anything that was generated automatically (especially the vanilla print
handler), is more like what one would want to do.  The documentation strings
for slots could be printed by DESCRIBE, and the accessor could have a
documentation string created from the slot description.  The documentation
string could be specified as a third object in each slot description:

(defstruct (elephant :conc-name)
  (color 'GRAY
	 "The elephant's color, should be one of GRAY, BROWN, or PINK.")

The documentation string for ELEPHANT-COLOR could look like:
"The accessor for the COLOR slot of the ELEPHANT structure.
 The COLOR slot's documentation is:
 The elephant's color, should be one of GRAY, BROWN, or PINK."