My thesis uses
WebKit as a text-rendering engine. This has a number of advantages that make it worth the effort: easy printing is one, the familiarity of manipulating documents through the DOM is another. The main disadvantage so far is having to do the whole thing in Objective-C with the Cocoa framework. I didn't expect to dislike this combination, but when I sometimes feel like I should just can the whole thing and do it over in Java (!), then you know something must be wrong.
Among the annoyances:
- We'll start with the most trivial one. Cocoa doesn't have any kind of random number framework-you have to use BSD's random(), and roll your own functions around that. Now, I don't like the way Java does random numbers, but at least its library provides a way of generating random numbers with a Gaussian distribution (which would have been helpful for this project). (Anyone know of a good C library that will do this for me?)
- Cocoa doesn't have a native regular expressions library either. Yes, I know you can do this with regular C, and I know there are third party frameworks out there to help you do regular expressions in a more Cocoa-ish way, but this still feels like a huge omission to me, especially when NSString has so many other niceties.
- No garbage collection. Not only that, but the rules about when to use [object retain] and [object release] are weird and cryptic and kind of scary.
- Cocoa method names are usually needlessly verbose. Whoever chose objectAtIndex as the method to get an object from an indexed collection (instead of, say, get) should have to PAY for all the weird line breaking contortions I have to do in order to make my code neat.
Sure, I'd have garbage collection if I used Objective-C 2.0, and using Python would solve nearly all my problems. I wanted to learn the framework in its native language, though, and more importantly I want all this stuff to work on 10.4 in addition to 10.5. (Also, and most importantly, I don't have Leopard yet.)