Archive for May 24, 2011

Tuesday, May 24, 2011

Regarding Objective-C & Copland 2010

Guy English:

So, in the end, while I appreciate the thinking behind Copland 2010 I don’t believe it’s quite the issue Siracusa believes it is. Objective-C continues to evolve, and in directions I believe will be increasingly important in the future. I don’t believe we’re anywhere near the level of crisis that Apple hit with Classic Mac OS and I don’t believe that a total second-system re-write without a clear goal is the best prescription for the platform.

Siracusa’s original piece was written after a long period of near stagnation in Objective-C. Apple has since made major improvements to the language such as garbage collection and blocks. Objective-C and the Cocoa frameworks could still use a lot of work, but I don’t think they’re approaching the edge of a cliff. There’s room for continued evolution. If Apple keeps working on it, I think they’ll be fine.

A distinction that’s not commonly discussed is that, although Objective-C provides automatic memory management via garbage collection (on Mac OS X, but not iOS), it is not a true managed or safe language like Java, C#, or Python. It’s still possible to have bad pointers and to reference memory that has been deallocated, and this leads to unexpected behavior or a crash, rather than a NullPointerException or an AttributeError. Likewise, an infinite recursion in Objective-C will crash rather than produce a StackOverFlowError or RuntimeError. Ideally, it would not be possible to call a function with the wrong number or type of arguments.

At this point, Objective-C’s hybrid nature is probably a plus. However, I would like to see it evolve in the direction of increased safety. Microsoft seems to have a successful transition strategy, where managed and unmanaged code can be mixed in the same application while remaining isolated. A successor language from Apple could potentially remove the unsafe C parts and compile down to a VM but still call into classic Objective-C where needed.