On Dec 10, 2012, at 11:45 AM, Christiaan Hofman <cmhof...@gmail.com> wrote:


On Dec 10, 2012, at 20:29, Adam R. Maxwell wrote:

>
>
> On Dec 10, 2012, at 10:59 AM, Christiaan Hofman <cmhof...@gmail.com> wrote:
>

>> I don't really like the typing changes to the delegate/dataSource methods. Isn't that wrong by itself? If it were requried methods I think it would complain about missing methods.
>
> Frankly, I'm not happy with them either. Changing the type in the method does work to silence the compiler warnings, and there were dozens of them. The alternative is to cast or redefine parameters using the correct type. For float/struct types, this matters, but for objects and ints, I think it should just shut up and work like it used to. I think the clang compiler typing requirements suck.
>

Perhaps the nicest solution is to use a local typed variable, PDFAnnotation *note = item;.
 
Yep, that'll work in many cases, or even easier, rename the method parameter to anItem and declare PDFAnnotation *item = anItem.  Where it gets tricky is with Skim's own annotation class, IIRC.  I did this a few weeks ago, so the memory is fuzzy...

> BTW GCC_WARN_UNUSED_PARAMETER = YES produces 511 warnings, one for almost every method and function :).

Guess that should be removed then.

>
> Apple seems to be going for some kind of C++ or Java typing, and that's really annoying. IMO, Obj-C has gotten worse in the last few revs, and I blame the C++ guys that are working on clang to some extent. I'm not enamored with the new literal syntax, much less the dot-syntax accessor abomination. To be fair, I also don't like KVO and KVC as they do nasty things with classes and discard too much type info for my taste, and that predates clang. Maybe I'm just grumpy...
>
> -- adam
>
> (with apologies if quoting is screwed up...icloud webmail is lame)

I agree. There are some conveniences, but it basically goes completely against the philosophy of Obj-C, getting some messy inconsistent language.
 
The really damning thing as far as I'm concerned is that of the hundreds of warnings that I waded through and "fixed," there were only a couple of potential significance (the URL/pboard one and the types mutable array).  The others were just annoying.  I used to like compiler warnings, but it seems like you can hardly even use id anymore without sprinkling casts around, and those can end up hiding problems during future refactorings.

For every genuine problem that clang or the static analyzer has pointed out, I've probably fixed a dozen non-issues, often with uglier code as the result.  I've resorted to #ifndef __clang_analyzer__ several places in FileView and TLU, just to avoid ridiculous rewrites.  One of my favorites is this:

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
+ (id <NSObject, NSCopying>)newKeyForURL:(NSURL *)aURL;
{
    return (id <NSObject, NSCopying>)[_FVCacheKey newWithURL:aURL];
}
#pragma clang diagnostic pop

It complained because I wasn't returning a FVCacheFile* from a +new method on FVCacheFile (and I think in FVCGImageCache I had to remove the protocol also).  Yeah, I could file a bug report, but I've pretty much given up on that; at least complaining here is cathartic, and ultimately no less productive.  Maybe even better if I learn a new workaround :).

--
adam

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Bibdesk-develop mailing list
Bibdesk-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop

Reply via email to