CLOS/MOP question
From: rif (rif_at_mit.edu)
Date: 10/31/04
- Next message: rif: "Re: Special variables question"
- Previous message: Rahul Jain: "Re: Running Standalone Lisp Programs"
- Next in thread: Rahul Jain: "Re: CLOS/MOP question"
- Reply: Rahul Jain: "Re: CLOS/MOP question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Oct 2004 22:39:45 -0400
Abstraction of my problem: I have a hierarchy of classes. For any
object in this hierarchy, it is meaningful (the semantics are
well-defined) to combine two objects into a new object (whose class
will be the LCA of the two classes in the hierarchy). Every slot in
the class can be either a "foo" slot or a "not-foo" slot --- if it's a
"foo" slot, then I combine the appropriate slots of the two objects in
a certain way, if it's a "not foo" slot, then I do it in a different
way.
What are good ways to accomplish this using CLOS/MOP? I'm using
CMUCL, and I'd prefer it to be as portable as possible, but I'm just
considering options at this point. I can certainly imagine ways to do
what I want by going outside of CLOS --- basically defining my own
macros around defclass to keep track of things, but I'm wondering if
this is a reasonable CLOS/MOP task.
My initial idea was to subclass standard-direct-slot-definition (and
similarly standard-effective-slot-definition) to make
foo-or-not-foo-slot-definition, which I can certainly do, but then I'm
stuck --- I imagine I'd need to subclass standard-class to
foo-or-not-foo-standard-class in such a way that all the slots in
objects subclassed from this were foo-or-not-foo-slots (and then
create my classes with the :metaclass option), but I don't know how to
do that. Any suggestions how to do that, or anything else relevant?
I have the Art of the MOP, but I'm not immediately finding what I'm
looking for in there. I suppose I should just read the whole book,
but I don't quite have the time right now...
Cheers,
rif
- Next message: rif: "Re: Special variables question"
- Previous message: Rahul Jain: "Re: Running Standalone Lisp Programs"
- Next in thread: Rahul Jain: "Re: CLOS/MOP question"
- Reply: Rahul Jain: "Re: CLOS/MOP question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|