Sunday, November 15, 2009

Getting my head around Cocoa

I needed cvs on my new macbook, so I installed xcode, so I didn't have to figure out how to use macports.

I had xcode, so I cracked it open. And for the first time, I'm noodling a bit with a compiled version (I've compiled java from time to time, but was never sucked into actually playing with it the way I have with perl & javascript).

As always with a new toolkit, the radical differences are jumping out at me.

Messages! what a trip! [Receiver message]. So yes, I get that foo.bar() is basically, in many ways the same thing as [foo bar] (tell foo that it should "bar()". Somehow more elegant.

The other thing is passing named values is the default. Yes, you can make the default value an array, but now that I'm constantly context switching, I really can't remember what goes where in an array, so I really appreciate:

[foo bar:baz silly:YES]

And of course it's odd to be so illiterate that I can't even type two lines without generating warnings and errors. I'm such a noob!