12 January 2008
It has long seemed to me that C++ and Objective-C are very complimentary. It is interesting that they are actually very easy to combine. The result is known as “Objective-C++”. C++ is nice for “value” classes. i.e. Classes whose instances tend to the value of variables. Operator overloading is particularly nice for numeric classes or “smart” pointers. Exceptions are nice too. (Though I still wish C++ had “finally”. Yeah, I know the usual C++ alternative, but that doesn’t mean it can’t be convenient.) Objective-C is nice for “reference” classes. i.e. Classes whose instances tend to be referenced by pointer or reference variables. Add automatic garbage collection for the Objective-C objects, and you’ve got a really nice set of language features. Last I looked, just about all those pieces where there, but getting them to work together on whatever platform you’re on could be difficult. These days, though, I’m preferring vanilla C, Scheme, or even EcmaScript over C++ or Objective-C.