summaryrefslogtreecommitdiff
path: root/Lisp/libobjcl.lisp
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-02-05 21:10:49 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-02-05 21:10:49 +0100
commitd1e41d41cf30d941b8d8820c8c2e5bbaf7db4391 (patch)
treea78ef364e993178bdcffac72332d12c273c4e2d8 /Lisp/libobjcl.lisp
parent5d85955361122f9862d28af23a29a2d146a360ce (diff)
Assign the root metaclass as a metaclass to every metaclass except itself.
darcs-hash:459f98ad1f243ae33843a4ba12e01fb772303084
Diffstat (limited to 'Lisp/libobjcl.lisp')
-rw-r--r--Lisp/libobjcl.lisp29
1 files changed, 28 insertions, 1 deletions
diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp
index f686c9d..536938e 100644
--- a/Lisp/libobjcl.lisp
+++ b/Lisp/libobjcl.lisp
@@ -299,7 +299,34 @@ conventional case for namespace identifiers in Objective-C."
(find-class 'objective-c-class))))
(or (find-class class-name nil)
(c2mop:ensure-class class-name
- :metaclass 'objective-c-meta-class
+ ;; If there is no superclass, we are
+ ;; the root metaclass. As we cannot
+ ;; assign ourselves as our own
+ ;; metaclass (which is a pity, because
+ ;; it would be the correct thing to
+ ;; do), we use OBJECTIVE-C-META-CLASS
+ ;; as our metaclass and regrettably
+ ;; miss out on some features. (Sorry,
+ ;; you can't get at +NS-OBJECT's
+ ;; slots.)
+ ;;
+ ;; If the superclass is the root
+ ;; metaclass, we take it as our
+ ;; metaclass, because the root
+ ;; metaclass is the metaclass of all
+ ;; metaclasses.
+ ;;
+ ;; Otherwise, we use the metaclass of
+ ;; the superclass as our own, which
+ ;; will always get us the root
+ ;; metaclass.
+ :metaclass (if non-meta-superclass
+ (if (eq (class-name
+ (class-of superclass))
+ 'objective-c-meta-class)
+ superclass
+ (class-of superclass))
+ 'objective-c-meta-class)
:pointer class-ptr
:direct-superclasses (list superclass)))))))