Re: XCode 2 upgrade problems... multiple methods with the samenameerrors
Re: XCode 2 upgrade problems... multiple methods with the samenameerrors
- Subject: Re: XCode 2 upgrade problems... multiple methods with the samenameerrors
- From: Ondra Cada <email@hidden>
- Date: Wed, 22 Mar 2006 17:41:14 +0100
Stephen,
On 22.3.2006, at 17:10, Stephen C. Jensen wrote:
I ran into a whole slew of errors... most involved multiple methods
with the same name
...
... why did I need to rename those functions? Both are defined
within an object ("employee"), so when I call [employee uniqueID],
why does the compiler complain? Why should there be any conflicts
in namespace between my object and [NSEvent uniqueID], or
[NSScriptObjectSpecifiers uniqueID]? I always thought that was one
of the benefits of object oriented programming... what am I missing?
Note there's a world of difference betwixt a message/method and
function :)
That aside -- I guess they weren't errors but warnings, and they
informed you of different signatures, right?
ObjC would happily send any message to any object, just like its
predecessor (kind of :)) Smalltalk did. There's a problem with the C
part here though: presume there are two methods in two different
classes:
-(void)recomputeWith:(float)f;
-(void)recomputeWith:(int)i;
and you write
id o;
...
[o recomputeWith:1];
The compiler can (and would) send the message without a glitch
regardless which class the receiver belongs to, but how on earth
should it store the argument? An integer should be in GPR5 (PPC of
course, damn those intels with their mediocre register sets!), whilst
a float would go to FPR1 -- what now?
That's why the compiler complains in case it finds more different
signatures for the same message. Presumably your uniqueID would
return somthing different from an unsigned long long :)
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden