[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing slot class
- To: friedman@aramis.rutgers.edu
- Subject: Re: Changing slot class
- From: kanderso@DINO.BBN.COM
- Date: Tue, 28 Mar 89 15:21:13 -0500
- Cc: Commonloops.pa@Xerox.COM
- In-reply-to: Your message of Fri, 24 Mar 89 14:28:33 -0500. <CMM.0.88.606770913.friedman@porthos.rutgers.edu>
- Redistributed: Commonloops.pa
Date: Fri, 24 Mar 89 14:28:33 EST
From: Gadi <friedman@porthos.rutgers.edu>
Reply-To: friedman@aramis.rutgers.edu
To: Commonloops.pa@xerox.com
Subject: Changing slot class
Message-Id: <CMM.0.88.606770913.friedman@porthos.rutgers.edu>
Is a rough draft of Chapter 3 available yet?
No. There are old drafts, but you don't want them.
I would like to know if it will be possible to change the class
of a slot from STANDARD-SLOT-DESCRIPTION. I Would like to be able
to maintain more information about my slots, such as a cardinality,
and valueclass, prevous value, etc. I know I can store Instances
in my slots that will contain all the information, but I will
have to write all my own access functions.
Gadi
Well, the metaclass has control of the slots, so it is fairly straight
forward to add features onto the slot descriptions. Basically,
you need a metaclass that uses the new slot descriptions:
(defclass new-class
(standard-class)
())
(defclass new-slotd
(standard-slot-description)
(... your new slots ...))
(defmethod make-slotd ((class new-class) &rest keywords-and-options)
(apply #'*make-instance 'new-slotd keywords-and-options))
(defmethod legal-slotd-option-p ((class new-class) key)
...)
Now classes you define with new-class as their metaclass will have the
new kind of slot description.
This can basically give your slots "facets" that are shared by each
instance of a class. Each instance, will still have only a local slot
value in the instance.
If you want to let each instance have a set of facets for each slot, you'll
have to do a bit more work.
k