• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: XCode 2 upgrade problems... multiple methods with the samenameerrors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCode 2 upgrade problems... multiple methods with the samenameerrors


  • Subject: Re: XCode 2 upgrade problems... multiple methods with the samenameerrors
  • From: William Bumgarner <email@hidden>
  • Date: Wed, 22 Mar 2006 08:44:24 -0800

On Mar 22, 2006, at 8:10 AM, Stephen C. Jensen wrote:
... 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? Also, why the complaints now and not with XCode 1? I suspect I have a setting that is different...

NSEvent:

- (unsigned long long)uniqueID;	

NSScriptObjectSpecifiers:

- (id)uniqueID;

Presumably, your employee class has a different declaration for the method.

More likely than not, you are referring to your employee as type "id", the generic objective-c object pointer. As such, the compiler doesn't know which of the uniqueID method signatures you are intending to call. Objective-C does not do dispatch inferencing based on the argument and return type of the methods (like other languages), thus the compiler cannot infer what you mean either.

If you move to using specific type declarations, the compiler can be more specific in its type checking. That is, use....

Employee *employee;

... instead of ....

id employee;

So, why the change? In between the old version of Xcode and the modern version you are using now, the compiler was changed to emit many more warnings about potentially problematic code. The warnings are indicating that there are potential problems in your code. The potential problems were always there, the tools just didn't automatically detect them before.

Frankly, that NSEvent and NSScriptObjectSpecifiers declare methods with identical selectors (names), but different type signatures, is rather unfortunate and, even, borders upon a bug. There are only a few methods for which a similar overlap exists.

b.bum



_______________________________________________
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


References: 
 >XCode 2 upgrade problems... multiple methods with the samenameerrors (From: "Stephen C. Jensen" <email@hidden>)

  • Prev by Date: Re: Wake from sleep notifications and preventing idle sleep
  • Next by Date: Want to be called or notified when the screen saver kicks in and out
  • Previous by thread: Re: XCode 2 upgrade problems... multiple methods with the samenameerrors
  • Next by thread: My little file copy/backup program
  • Index(es):
    • Date
    • Thread