[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
defstruct slot info
- To: firstname.lastname@example.org
- Subject: defstruct slot info
- From: email@example.com (Sandra J Loosemore)
- Date: Thu, 1 Oct 87 21:24:37 MDT
Pablo Ghenis writes:
> What useful things could one do with the output of (structure-slots
> <structure-name>), given that the choice of slot to access cannot be
> gracefully deferred until run-time the way p-lists allow? I'm afraid
> that a "structure-slots" function wouldn't be all that valuable because
> of this deeper limitation of structures.
If the function returned more information than just the slot names --
like the name of the accessor function for each slot, and maybe the
:type and :read-only flags -- then it would be very useful. For
example, I could implement a portable data structure browser.
Basically, I'd like to be able to display a structure as a box with
labelled sub-boxes to show (and maybe modify) the slot values. Without
an inquiry function, about the only alternative is to redefine DEFSTRUCT
to cache the information I need. I definitely want to avoid forcing
users (who are probably having enough troubles already if they're
resorting to the use of this kind of debugging tool) to define a special
"browser" function for each structure type they use, akin to the
structure print function.
My experience is that many (most? all?) implementations already cache at
least the slot descriptor information around somewhere, since it's used
when you :include the structure type in another.
Incidentally, my gripe with structures right now has to do with the
"maybe modify" the slot values part -- because of the reliance on SETF,
I have to construct and EVAL a piece of code, when I would really much
rather just FUNCALL a setter function....