Cocoalate

Adventures in the transition from C to Cocoa.

Thursday, January 10, 2008

Complacency

I've had a few experiences lately that have silently demonstrated how much I've taken to Objective-C.

First, I've started to forget even more about the basic POSIX function parameters. I used to resort to reading man pages all the time, just to make sure I got the parameters right, but there were a few functions that I had down. Now I've forgotten those few that I had down, causing all kinds of silly little bugs.

I've also discovered, as I'm integrating some C++ code into a project, that I really hate Operator Overloading. I used to think this was the hottest feature ever, and I'm sure it still has some uses somewhere. But over all, it's just irritating to deal with. Is this variable a char *, a String, or some fancy derivative thereof? Now I have to jump to the definition, to find that it's some other class entirely. But it behaves like a basic C string, with some additional features.

I guess I'm growing old, and getting set in my ways...

Tuesday, November 27, 2007

Too much, Too little

Objective-C 2.0 has completely changed the game (and rendered most of the earlier gdb tricks mentioned to no longer work as well). That said, it has also added some pretty slick new features that I hope I'll be able to give justice to once I get some more free time and some more coherent thoughts.

Just thought I'd let y'all know where things were.

Thursday, November 1, 2007

Best console log message ever

I was put between a rock and a hard place. Basically, I had to call a method on a class that isn't exported (i.e. I'm in plugin-space, and it needs to invoke something on an application-internal class that isn't exported). Through some trickery, I was able to get it working (man I love objective-C!). However, inserting the plugin into an application that doesn't have such a class results in an amazing console error that I've never seen before:


Nov 1 18:33:02 phendrana Photo Booth[33276]: *** NSInvocation: warning: object 0xfce0e0 of class 'specialInternalClass' does not implement methodSignatureForSelector: -- trouble ahead
Nov 1 18:33:02 phendrana Photo Booth[33276]: *** NSInvocation: warning: object 0xfce0e0 of class 'specialInternalClass' does not implement doesNotRecognizeSelector: -- abort


that "trouble ahead" part is awesome. I think it happens to any OC object that doesn't inherit from NSObject, but gets treated like it does. Fun stuff, that :)

Categories