discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC] GSObjCRuntime API conventions


From: David Ayers
Subject: [RFC] GSObjCRuntime API conventions
Date: Thu, 03 Jun 2004 13:09:57 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040514

Hello everyone,

Now that Adam announced that there is a -base release coming up soon, I've shuffled priorities again so that the next -base release may include some extensions which I have found necessary in certain situations and I'd like to use them in GDL2.

What I currently have is a set of +load safe functions to influence category precedence. They overlap with certain "behavior" functionality, in fact I've locally reimplemented GSObjCAddClassBehavior to use this new API and it seems to work well. In my local tree I currently have:

typedef struct objc_method_list *GSMethodList;

...
GSMethodList GSClassMethodListForSelector(Class class, SEL selector,
                                          void **iterator);
GSMethodList GSInstanceMethodListForSelector(Class class, SEL selector,
                                             void **iterator);
void GSClassAddMethodList(Class class, GSMethodList list);
void GSInstanceAddMethodList(Class class, GSMethodList list);
void GSClassRemoveMethodList(Class class, GSMethodList list);
void GSInstanceRemoveMethodList(Class class, GSMethodList list);

I had introduced the following preliminary API with similar conventions:

typedef struct objc_method      *GSMethod;

GSMethod GSGetInstanceMethod(Class class, SEL sel);
GSMethod GSGetClassMethod(Class class, SEL sel);
GSMethod GSGetInstanceMethodNotInherited(Class class, SEL sel);
GSMethod GSGetClassMethodNotInherited(Class class, SEL sel);

The conventions I'd like to have comments on, is the explicit Class/Instance separation and the explicit Inherited/NotInherited separation as apposed to collapsing those functions into on which takes BOOL flags to determine whether Class vs. Instance or recursive behavior is requested.

This would result in the collapsing the above API to:

GSMethodList GSMethodListForSelector(Class class, SEL selector,
                                     void **iterator,
                                     BOOL searchInstanceMethods
                                     BOOL searchSuperClasses);
void GSAddMethodList(Class class, GSMethodList list,
                     BOOL toInstanceMethods);
void GSClassRemoveMethodList(Class class, GSMethodList list,
                             BOOL fromInstanceMethods);

GSMethod GSGetMethod(Class class, SEL sel,
                     BOOL searchInstanceMethods,
                     BOOL searchSuperClasses);


A similar issue (wrt GSObjC/GSC and Inherited/NotInherited) was previously discussed here:
http://lists.gnu.org/archive/html/bug-gnustep/2003-06/msg00011.html

If we prefer to keep the former convention, I'll post a separate RFC for the actual API additions with further comments on what this API does and how it can be used to influence category precedence, otherwise I'll adapt it first.

Cheers,
David

PS: This also touches: http://lists.gnu.org/archive/html/discuss-gnustep/2004-04/msg00176.html
as we may want to replace (via deprecation)
NSArray *GSObjCMethodNames(id obj);
with
NSArray *GSObjCGetMethodNames(Class cls,
                              BOOL searchInstanceMethods,
                              BOOL searchSuperClasses);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]