Article View: comp.lang.clos
Article #527Creating metaclasses
From: Jon L White
Date: Thu, 02 May 1991 06:36
Date: Thu, 02 May 1991 06:36
87 lines
3519 bytes
3519 bytes
re: [make a metaclass MY-CLASS that is its own metaclass]
The following excerpt from Chapter 6 seems to suggest that
what I want is impossible.
I hope it doesn't really make it "impossible", but simply leaves it as
unspecified.
The intent for Lucid's CLOS is to be able to do this, but after the 4.0
release went out, we discovered a glitch that prevented doing it in a
straightforward way. Thanks to Kim Barrett of Chestnut Software for
pointing this out last September; it is filed as bug report #05645
"RFE: want to be able to make circular CLASS-OF link", and with this
patched, your example is quite feasible. [see the "dribble" below.]
I say "feasible" rather than "straightforward", given all the constraints;
for example, note the need for doing the defmethod for VALIDATE-SUPERCLASS
at exactly the right point in time. [Of course, you could retract that
method at a later time if you wanted to; but you might need it if you are
expecting MY-OBJECT to serve as a kind of "maximal" class within the MY-CLASS
metaclas hierarchy. For other variations on this theme, see my email msg:
Date: Tue, 12 Feb 91 14:48:41 PST
From: Jon L White <jonl>
To: kanderso@BBN.COM
Cc: john@linus.mitre.org, barmar@think.com, commonloops@cis.ohio-state.edu
Subject: accessing clos objects
]
. . .
> (load "/pods/central/patches/bug-5645")
;;; Loading binary file "/pods/central/patches/bug-5645.sbin"
#P"/tmp_mnt/net/ss/patches/bug-5645.sbin"
> (setq mo (defclass my-object (standard-object) ((file))))
#<Standard-Class MY-OBJECT>
> (setq mc (defclass my-class (standard-class my-object) ((my-class-info))))
#<Standard-Class MY-CLASS>
> (defmethod clos-sys:validate-superclass ((x my-class) (Y standard-class)) t)
#<Standard-Method VALIDATE-SUPERCLASS (MY-CLASS STANDARD-CLASS)>
> (change-class mc mc)
#<My-Class MY-CLASS>
> (change-class mo mc)
#<My-Class MY-OBJECT>
> (describe mo)
Class Object:
Name: MY-OBJECT
MetaClass: MY-CLASS
Class-Precedence-List: (MY-OBJECT STANDARD-OBJECT T)
Direct-Superclasses: (STANDARD-OBJECT)
Direct-Subclasses: (MY-CLASS)
DirectSlots:
SlotName Allocation TypeSpec
FILE
> (describe mc)
Class Object:
Name: MY-CLASS
MetaClass: MY-CLASS
Class-Precedence-List: (MY-CLASS STANDARD-CLASS CLOS::SLOTTED-CLASS CLASS MY-OBJECT STANDARD-OBJECT T)
Direct-Superclasses: (STANDARD-CLASS MY-OBJECT)
Direct-Subclasses:
DirectSlots:
SlotName Allocation TypeSpec
MY-CLASS-INFO
InheritedSlots:
SlotName Allocation TypeSpec
FILE
CLOS::NAME
CLOS::DIRECT-SUPERCLASSES
CLOS::DIRECT-SUBCLASSES
CLOS::DIRECT-METHODS
CLOS::DIRECT-FORWARD-REFERENCED-SUPERCLASSES
CLOS::PRECEDENCE-LIST
CLOS::FULLY-DEFINED-P
CLOS::WRAPPER-AND-ISLOT-COUNT
CLOS::PLIST
CLOS::DIRECT-SLOTS
CLOS::SLOTS
CLOS::DEFAULT-INITARGS
CLOS-SYSTEM:SLOTD-INITARGS
>
-- JonL --
Technical Details
Message-ID:
<9105020636.AA28415@kuwait>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!tut.cis.ohio-state.edu!unreplyable!garbageReferences:
<9105020128.AA28067@cs.rpi.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!tut.cis.ohio-state.edu!unreplyable!garbage From: jonl%kuwait@LUCID.COM (Jon L White) Newsgroups: comp.lang.clos Subject: Creating metaclasses Message-ID: <9105020636.AA28415@kuwait> Date: 2 May 91 06:36:43 GMT References: <9105020128.AA28067@cs.rpi.edu> Sender: welch@tut.cis.ohio-state.edu Distribution: inet Organization: CommonLoops Lines: 87