[Openmcl-devel] Custom Meta Classes

Sven Van Caekenberghe sven at beta9.be
Thu Jan 15 01:33:01 PST 2004


In OpenMCL 0.13.x I could define my own meta classes like this:

Welcome to OpenMCL Version (Beta: Darwin) 0.13.6!
? (defclass foo-meta-class (standard-class) ((extra-info :accessor 
get-info)))
#<STANDARD-CLASS FOO-META-CLASS>
? (defclass foo () ((bar :accessor get-bar)) (:metaclass 
foo-meta-class))
#<FOO-META-CLASS FOO>
? (make-instance 'foo)
#<FOO #x52B318E>
? (describe *)
#<FOO #x52B318E>
Class: #<FOO-META-CLASS FOO>
Wrapper: #<CCL::CLASS-WRAPPER FOO #x52B316E>
Instance slots
BAR: #<Unbound>

This works in LispWorks 4.3 as well.
In OpenMCL 0.14.x I get the following error:

Welcome to OpenMCL Version (Alpha: Darwin) 0.14-031220!
? (defclass foo-meta-class (standard-class) ((extra-info :accessor 
get-info)))
#<STANDARD-CLASS FOO-META-CLASS>
? (defclass foo () ((bar :accessor get-bar)) (:metaclass 
foo-meta-class))
 > Error in process listener(1): The class #<STANDARD-CLASS 
STANDARD-OBJECT> was specified as a
 >                               super-class of the class 
#<FOO-META-CLASS FOO>;
 >                               but the meta-classes #<STANDARD-CLASS 
STANDARD-CLASS> and
 >                               #<STANDARD-CLASS FOO-META-CLASS> are 
incompatible.
 > While executing: #<CCL::STANDARD-KERNEL-METHOD SHARED-INITIALIZE 
:AFTER (CCL::SLOTS-CLASS T)>
 > Type :POP to abort.
Type :? for other options.
1 > :b
(F0135B50) : 0 "#<CCL::STANDARD-KERNEL-METHOD SHARED-INITIALIZE :AFTER 
(CCL::SLOTS-CLASS T)>" 236
(F0135B60) : 1 "CCL::%%BEFORE-AND-AFTER-COMBINED-METHOD-DCODE" 708
(F0135B70) : 2 NIL NIL
(F0135B80) : 3 "CCL::%%STANDARD-COMBINED-METHOD-DCODE" 148
(F0135B90) : 4 NIL NIL
(F0135BA0) : 5 NIL NIL
(F0135BB0) : 6 NIL NIL
(F0135BC0) : 7 "CCL::%%STANDARD-COMBINED-METHOD-DCODE" 148
(F0135BD0) : 8 NIL NIL
(F0135BE0) : 9 "CCL::%MAKE-STD-INSTANCE" 296
(F0135BF0) : 10 NIL NIL
(F0135C00) : 11 "#<CCL::STANDARD-KERNEL-METHOD MAKE-INSTANCE 
(STANDARD-CLASS)>" 56
(F0135C10) : 12 "#<CCL::STANDARD-KERNEL-METHOD ENSURE-CLASS-USING-CLASS 
(NULL T)>" 108
(F0135C20) : 13 NIL NIL
(F0135C30) : 14 "CCL::CALL-CHECK-REGS" 72
(F0135C40) : 15 NIL NIL
(F0135C50) : 16 "CCL::TOPLEVEL-EVAL" 128
(F0135C60) : 17 "CCL::READ-LOOP" 824
(F0135CA0) : 18 "TOPLEVEL-LOOP" 44
(F0135CC0) : 19 "Anonymous Function #x510EF96" 104
(F0135CD0) : 20 NIL NIL
(F0135CE0) : 21 "Anonymous Function #x51389F6" 500
(F0135D00) : 22 "CCL::RUN-PROCESS-INITIAL-FORM" 348
(F0135D30) : 23 NIL NIL
(F0135D40) : 24 "Anonymous Function #x50FC336" 152
(F0135D60) : 25 "Anonymous Function #x50F7C3E" 172

This vaguely reminds me of an error I saw in CMUCL with the same code 
where you had to validate the new meta class...

Sven

--
Sven Van Caekenberghe - mailto:sven at beta9.be
Beta Nine - software engineering - http://www.beta9.be
.Mac - svc at mac.com - http://homepage.mac.com/svc

"Lisp isn't a language, it's a building material." - Alan Kay 




More information about the Openmcl-devel mailing list