Will JavaScript replace Objective-C as the primary language of Cocoa?
Reading the announcement of SquirrelFish Extreme it crossed my mind that since Apple seems to be putting a lot of effort into JavaScript performance perhaps there’ s more to it than speeding up Safari. Maybe Apple want to make JavaScript fast enough that it could replace Objective-C in the the majority of desktop Cocoa applications.
I never used the ill fated Java version of Cocoa, but from the bit of exposure I’ve had, JavaScript seems like a much more suitable replacement for Objective-C than Java. In fact, I would say that JavaScript, being prototype based, is quite a bit more flexible than Objective-C (though whether that’s a good thing may be questionable). Presumably Java was originally chosen, despite its static typing, because of its popularity but these days is seems like JavaScript is getting more any more attention as a serious language. I suspect in a few years time, JavaScript will become the most common first programming language for engineers, much the way BASIC used to be, simply because it’s so widely deployed in the web browser platform.
Though Apple must be happy with the Objective-C ecosystem they’ve developed, no one else appears to be moving towards it as a language. When compared to C# as in .Net or the Java-ish platform Google is pushing for Android, Objective-C seems difficult to learn and quite low level, especially without garbage collection as on the iPhone. Fewer and fewer engineers even seem to learn C these days, which will no doubt make Objective-C appear more and more difficult to newcomers over time.
The obvious first objection to using JavaScript in the desktop application scenario would be performance, but with so much effort going into improving it, it seems like it won’t be long before it is at least on par with virtual machine languages like C# and Java. To add a bit more evidence to the pile, Apple is clearly somewhat taken with JavaScript if they’re talking about JavaScript frameworks like SproutCore (which I’m told is very Cocoa-like) at WWDC and there are already bindings available for Dashboard widget development.
Ruby and Python might also be viable options if Apple were to move away from Objective-C, but currently suffer the same performance difficulties, and don’t seem to be getting the same level of performance attention (at least from Apple). Time will no doubt tell, but thinking about it, I can’t see a language which would be more suitable as a replacement for Objective-C than JavaScript.

