Re: Amazed by macros working on first attempt
- From: tar@xxxxxxxxxxxxx (Thomas A. Russ)
- Date: 28 Jul 2005 11:17:48 -0700
"jonathon" <j_mckitrick@xxxxxxxxxxx> writes:
> One improvement I would like to make would be to use some kind of
> iterating or looping form to go through all the slots of a specific
> object and apply that macro to them and then export the result, so I
> can add a new slot and have the cross-package-accessor function
> automatically generated and even exported.
>
> How might I approach this problem?
Unfortunately, this one is a bit tricky, because standard ANSI Common
Lisp doesn't have a portable way of accessing slot information about
objects.
On the bright side, however, most Lisp systems now do implement at least
parts of the Meta-Object Protocol (MOP), and that provides a way of
getting the slot definitions of CLOS classes. You could use that as a
way of finding the slots to iterate across for CLOS objects. Whether
this would work for objects created by DEFSTRUCT, however, really
depends on the particular lisp implementation. But doing it for classes
should be sufficient for your purposes.
Take a look at http://www.lisp.org/mop/index.htm
--
Thomas A. Russ, USC/Information Sciences Institute
.
- Follow-Ups:
- Re: Amazed by macros working on first attempt
- From: Cameron MacKinnon
- Re: Amazed by macros working on first attempt
- References:
- Amazed by macros working on first attempt
- From: jonathon
- Amazed by macros working on first attempt
- Prev by Date: Re: professional package use?
- Next by Date: Re: professional package use?
- Previous by thread: Re: Amazed by macros working on first attempt
- Next by thread: Re: Amazed by macros working on first attempt
- Index(es):