[cfe-dev] Proposal to simplify ObjC Type AST's

Jens Ayton mailing-lists.jens at ayton.se
Sat May 23 12:58:01 PDT 2009


On May 20, 2009, at 17:45, steve naroff wrote:
>
> This sounds good to me.
>
> Consider the following pseudo code (for discussion...not meant to be  
> complete):
>
> @class Class, Protocol;
>
> @interface id // ObjCIdType: The implicit root of all ObjC objects.
> {
>   Class isa;
> }
> // All ObjC roots will inherit the following class methods.
> // This will greatly simplify defining an ObjC root class.
>
> + (Class)class;
>
> + (Class)superclass;
> + (BOOL)instancesRespondToSelector:(SEL)aSelector;
> + (BOOL)conformsToProtocol:(Protocol *)protocol;
> + (IMP)instanceMethodForSelector:(SEL)aSelector;
>
> - (BOOL)isKindOfClass:(Class)aClass;
> - (BOOL)isMemberOfClass:(Class)aClass;
> - (BOOL)conformsToProtocol:(Protocol *)aProtocol;
> - (BOOL)respondsToSelector:(SEL)aSelector;
> @end
>
> @interface Class // ObjCClassType: Will implicitly inherit from 'id'
>
> // No explicit ivar declarations, the structure of 'Class' is  
> intentionally opaque (since the details are runtime specific).
>
> - (Class)class;
> - (Class)superclass;
> - (BOOL)instancesRespondToSelector:(SEL)aSelector;
> - (BOOL)conformsToProtocol:(Protocol *)protocol;
> - (IMP)instanceMethodForSelector:(SEL)aSelector;
>
> @end

Putting aside the question of mixing framework conventions with the  
language, should instanceMethodForSelector: be here? It’s not part of  
the <NSObject> protocol, for for a very good reason: it’s not  
meaningful for most proxies.


-- 
Jens Ayton





More information about the cfe-dev mailing list