[cfe-dev] Proposal to simplify ObjC Type AST's
steve naroff
snaroff at apple.com
Sun May 24 10:45:16 PDT 2009
On May 23, 2009, at 3:58 PM, Jens Ayton wrote:
> 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.
>
Hi Jens,
The code was for discussion purposes (not a spec). Just because it
isn't meaningful for proxies, doesn't mean it shouldn't be part of the
core meta object protocol.
The ability to associate a selector with a pointer to a method is kind
of fundamental (and from my perspective makes sense).
snaroff
>
> --
> Jens Ayton
>
More information about the cfe-dev
mailing list