diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-02-05 21:10:49 +0100 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-02-05 21:10:49 +0100 |
commit | d1e41d41cf30d941b8d8820c8c2e5bbaf7db4391 (patch) | |
tree | a78ef364e993178bdcffac72332d12c273c4e2d8 /Lisp | |
parent | 5d85955361122f9862d28af23a29a2d146a360ce (diff) |
Assign the root metaclass as a metaclass to every metaclass except itself.
darcs-hash:459f98ad1f243ae33843a4ba12e01fb772303084
Diffstat (limited to 'Lisp')
-rw-r--r-- | Lisp/libobjcl.lisp | 29 |
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))))))) |