3 ms·
It looks like everything here are platform features and not language features. The author likes the features of NSObject and NSAutoreleasePool and the fact that
by xsmasher 16y ago
It looks like everything here are platform features and not language features. The author likes the features of NSObject and NSAutoreleasePool and the fact that the Cocoa libraries make use of autorelease pools.
I have a similar fondness for the Cocoa platform. I was recently asked to port some work to another platform, and considered keeping Objective-C as the language... but my love for the language runs thin once Apple's libraries are gone. The dynamic typing and categories(adding methods to arbitrary classes) are still nice though.
- chc 16y agoThis is what I always try to explain to people. Objective-C is a slightly above-average core language (it's a minimal set of extensions to ISO C) with no standard library to speak of. Cocoa is an awesome library written in Objective-C. Any enjoyment you get from Objective-C programming (and pretty much anything you accomplish) is probably thanks to Cocoa, not Objective-C itself. To illustrate how minimal Objective-C is: There isn't even a standard root class. It includes an Object class, but using it is not mandatory, and only one class used in any Cocoa app is derived from it. There also isn't a "root class" protocol. Due to the lack of a standard root class, outside the safety of Cocoa, there isn't even a standard way to ask an object what class it is or what selectors is responds to.
- Zev 16y ago..outside the safety of Cocoa, there isn't even a standard way to ask an object what class it is or what selectors is responds to. Yes, there is. The Objective-C run time lets you do all of this. It is in C and not Objective-C. But, NSObject is barely more than a thin wrapper for these functions, anyway.
- stephth 16y agoI wish there was more documentation about the portability of Objective-C and specific Core Foundation features. It's hard to find a definitive answer. gcc supports Objective-C, and Apple open sources CF-Lite, but apparently and confusingly, that is only a subset of Core Foundation. I make OpenGL videogames but my code is written in Objective-C (long story) and so currently only supports iOS and OS X. I feel almost at home with ObjC and my codebase, I enjoy the features mentioned in this article, and it's performant enough for what I need, but I'm reaching a point where I wish my core logic code was multi platform (from PS3 to Android including iPhone). Moving to C++ would mean learning C++ and best practices (which sounds quite daunting to beginners) and rewriting the whole codebase, but the lack of practical documentation on the portability of Core Foundation looks like a big neon sign that dropping Objective-C is the only reasonable way towards a cross-platform codebase.