summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-02-04 15:32:37 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-02-04 15:32:37 +0100
commit4700986fb98b7b0685aa8d351d39cf14b67f6cf3 (patch)
tree7774aeea3ad10c69d8b0bd84c4b3853f58e2630a
parent94383388101170742989e188e020f91b81a2ddfe (diff)
Make ID the root of the Objective-C class hierarchy.
darcs-hash:7d709124e74a1782fecaf2ee75a0a229783fec8b
-rw-r--r--Lisp/class-definition.lisp4
-rw-r--r--Lisp/data-types.lisp10
-rw-r--r--Lisp/libobjcl.lisp6
3 files changed, 13 insertions, 7 deletions
diff --git a/Lisp/class-definition.lisp b/Lisp/class-definition.lisp
index e331d83..cac6041 100644
--- a/Lisp/class-definition.lisp
+++ b/Lisp/class-definition.lisp
@@ -45,6 +45,10 @@
t)
(defmethod c2mop:validate-superclass ((class objective-c-class)
+ (superclass standard-class))
+ t)
+
+(defmethod c2mop:validate-superclass ((class objective-c-class)
(superclass objective-c-class))
t)
diff --git a/Lisp/data-types.lisp b/Lisp/data-types.lisp
index 64979c0..e244e8d 100644
--- a/Lisp/data-types.lisp
+++ b/Lisp/data-types.lisp
@@ -108,14 +108,14 @@ The following calls are all equivalent:
(defclass id (c-pointer-wrapper)
()
- (:documentation "An instance of an Objective-C class.
+ (:documentation "The type of all Objective-C objects.
## Description:
-The class __id__ serves as a general-purpose container for all kinds of
-Objective-C objects that are instances of some Objective-C class, that
-is, neither primitive C values nor __selector__, __class__ or
-__exception__ objects.
+The class __id__ is the supertype of all Objective-C instance types. It
+comprises all kinds of Objective-C objects that are instances of some
+Objective-C class, that is, neither primitive C values nor __selector__,
+__class__ or __exception__ objects.
__id__ objects cannot be created by means of __make-instance__. Use
a suitable class method instead as you would in Objective-C.
diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp
index 618a8b1..bf166c4 100644
--- a/Lisp/libobjcl.lisp
+++ b/Lisp/libobjcl.lisp
@@ -253,7 +253,9 @@ conventional case for namespace identifiers in Objective-C."
(let ((class-ptr (%objcl-find-class class-name-string)))
(if (objc-pointer-null class-ptr)
nil
- (let ((class-name (objc-class-name->symbol class-name-string)))
+ (let ((class-name (objc-class-name->symbol class-name-string))
+ (superclass (or (objcl-class-superclass/pointer class-ptr)
+ (find-class 'id))))
(or (find-class class-name nil)
(c2mop:ensure-class class-name
:metaclass (class-name
@@ -261,7 +263,7 @@ conventional case for namespace identifiers in Objective-C."
class-name-string))
:pointer class-ptr
:wrapped-foreign-class class-name-string
- :direct-superclasses (list (objcl-class-superclass/pointer class-ptr))))))))
+ :direct-superclasses (list superclass)))))))
(defun find-objc-meta-class (meta-class-name &optional errorp)