[Top][All Lists]

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

Re: RFA: [base] GSObjCRuntime

From: David Ayers
Subject: Re: RFA: [base] GSObjCRuntime
Date: Tue, 25 Mar 2003 14:43:37 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210

Richard Frith-Macdonald wrote:

On Tuesday, March 25, 2003, at 12:31  pm, David Ayers wrote:

GS_EXPORT IMP GSObjCGetMethod(Class class, SEL sel); /*Notice I changed the name again ;-) */
GS_EXPORT IMP GSObjCReplaceMethod(Class class, SEL sel, IMP imp);

Sorry to be awkward but ...

Please do so ;-)

while I have no actual objection to you comitting what you've done,
wouldn't it be even better to make the name of the function GSObjCSetMethod rather than GSObjCReplaceMethod ... for consistency with the ivar management functions, and to add functionality such that, if the method does not already exist in the class, it is added (and a null
IMP returned for the old value of the method implementation).

This sounds like a good implementation for GSObjCSetMethod, but that's not what GSObjCReplaceMethod is currently doing. I have no objections to implementing GSObjCSetMethod as you describe it, but this would be more than just replaceing the implementation pointer. We would need to:
- find/create the corresponding struct objc_method_list
- augment it with an struct objc_method at the end,
- set SEL method_name,
- set const char* method_types /* signature*/
I think the hardest part would be extending an existing list. It would be relativly easy if we added a new list with a single entry for each new method, but that feels very inefficient.

I'll leave this until it is needed but feel free to implement it ;-)

I think we should stick with GSObjCReplaceMethod for the implementation we have now.


reply via email to

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