There has been a shift in development landscape over at Apple. John Siracusa of Ars Technica recently published an article about Apple’s language and API future. I believe Apple is preparing to transition to Ruby as their next default language.

Today

Today, the Apple development stack sits on top of the GCC compiler. GCC compiles Objective-C, C++, and C code down into native machine code for devices that run Mac OS X and iOS. Core Foundation is a set of C libraries that provide low level operating system services and fundamental data types. On the Macintosh, Cocoa is the set of frameworks that sit on top of Core Foundation. Cocoa Touch is the set of frameworks that sits on top of Core Foundation on iOS devices.

Generally, developers build applications using the XCode IDE. XCode is the GUI layer that drives the compiler, debugger, and build system.

LLVM & LLDB

XCode also ships with LLVM. LLVM is an open source compiler infrastructure that is meant to eventually replace the GCC tool chain.

LLVM allows the system to compile and optimize code at compile-time, link-time, and run-time. The compilers from Microsoft have been able to do link-time code generation for a number of years now. This allows the system an extra phase in which it can both optimize code and provide other types of diagnostics.

The LLVM project originally started at the University of Illinois. Apple has a team of developers that work on the project full time.

XCode currently ships with GDB as the debugger. The LLDB project was recently announced with the goal to replace GDB as the debugger that sits on top of LLVM. Currently, Mac OS X is the only supported platform. Browsing the list of committers shows email addressees from Apple. The project also has a very Apple-esque description:

The goal of LLDB is to provide an amazing debugging experience that “just works”.

Complete transition to the LLVM/LLDB stack will finally put Apple on par with the .NET stack that Microsoft ships. This stack contains a language agnostic runtime with multiple code optimization points that runs native code.

The Dalvik virtual machine that ships with Android interprets byte code. A byte code interpreter has a few advantages over a stack that runs native code. Performance is not one of those advantages.

MacRuby & Rubinius

Where does Ruby fit into all of this? Both MacRuby and Rubinius use the LLVM compiler infrastructure to compile Ruby into native code. The MacRuby project is driven by Apple and it sits on top o Core Foundation and uses the Objective-C runtime to execute.

Apple has implemented Blocks and Grand Central Dispatch in their latest release of the Objective-C runtime. They are available on iPhone as of the iOS 4.0 update. This is one of the features that the runtime would be required to implement to support Ruby blocks and lambda functions. Objective-C is a dynamic language as is Ruby, however this was one of the missing features between the two languages.

The Transition

A number of features still need to be implemented for a full transition to the Ruby language. However, all of the fundamental building block for this transition are there.

A hat tip goes out to Boris Mann. We had a great jam session early last week that led to a lot of clarification of my thoughts.