From 4700986fb98b7b0685aa8d351d39cf14b67f6cf3 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Mon, 4 Feb 2008 15:32:37 +0100 Subject: Make ID the root of the Objective-C class hierarchy. darcs-hash:7d709124e74a1782fecaf2ee75a0a229783fec8b --- Lisp/class-definition.lisp | 4 ++++ Lisp/data-types.lisp | 10 +++++----- Lisp/libobjcl.lisp | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'Lisp') 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 @@ -44,6 +44,10 @@ (superclass standard-class)) 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) -- cgit v1.2.3