[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to change inheritance of class options?
- To: info-mcl@services.cambridge.apple.com
- Subject: Re: How to change inheritance of class options?
- From: eric@pygmalion.starbase.mitre.org (Eric Peterson)
- Date: 27 Sep 1994 01:17:55 GMT
- In-reply-to: ethan+@pitt.edu's message of Mon, 26 Sep 1994 16:02:31 -0500
- Newsgroups: comp.lang.lisp.mcl
- Organization: MITRE
- References: <ethan+-2609941602310001@peaceful.cs.pitt.edu>
Dear netters,
I've created a metaclass with a particular behaviour, and made classes and
objects using it. Fine. However, when I make a subclass of one of my new
classes, it does not inherit the metaclass affiliation.
To clarify:
? (defclass mc0 (standard-class) ())
#<STANDARD-CLASS MC0>
? (defclass c0 () () (:metaclass mc0))
#<MC0 C0>
? (defclass c1 (c0) ())
#<STANDARD-CLASS C1>
i.e., the class-option slot is not being inherited. That is expected,
described in Steele. However, what I would like to have is
? (defclass c1 (c0) ())
#<MC0 C1>
How can I do this? I have tried messing with the defclass macro (out of my
league) and with make-instance (standard-class) and even default-initargs,
but I can't make sense of it. I have looked in the faq's, the MCL manual,
Steele, and Kiczales and it just makes me feel foolish...
I explicitly provide the :METACLASS arg to all such defclasses.
Well, actually I hide it in my own DEFCLASS+ macro which defaults to
my metaclass (here is a very stripped down and somewhat oversimplified
version of my macro):
(defmacro defclass+
(class-name superclasses slots . class-options)
`(defclass ,class-name
(,@superclasses standard-object+)
,slots
,@class-options
'(:metaclass standard-class+)))
I'm not completely sure that I'm addressing what you want, but I hope
this helps.
-Eric
--
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Eric L. Peterson
MITRE Corporation
Artificial Intelligence Technical Center
7525 Colshire Dr.
McLean, VA 22102-3481
Internet: eric@starbase.mitre.org
Phone: (703) 883-6116
Fax: (703) 883-6435
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
"I never meta-class I didn't like"
-anon
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;