On Wed, 10 Jun 2015 03:27:36 -0700, Greg Parker said:
>The canonical example is +[NSApplication sharedApplication]. Returning
>NSApplication means you always have to cast to your real NSApplication
>subclass, which is little more than syntactic noise. Returning id means
>you don't need the cast, but it also means you get no type checking and
>too many code completion results. Returning __kindof NSApplication is a
>good compromise.
Interesting example. My app has dozens of new warnings in Xcode 7 due to the
above. Hopefully this is not yet working as intended. Consider:
clang -Weverything -fsyntax-only ~/test.m
--------------
#import <AppKit/AppKit.h>
int main(void)
{
(void)[NSApp delegate];
return 0;
}
--------------
it gives:
/Users/sean/test.m:5:8: warning: multiple methods named 'delegate' found
[-Wstrict-selector-match]
(void)[NSApp delegate];
^~~~~~~~~~~~~~~~
Same if you use "[NSApplication sharedApplication]" instead of "NSApp".
(See rdar://21306753 which is really just rdar://6845498 still unfixed.)
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng [email protected]
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/objc-language/archive%40mail-archive.com
This email sent to [email protected]