main logo

I'm Sebastien Orban and I'm a hacker and a painter.

03 June 2014

The new Swift language from Apple

The more I look at the newly announced language from Apple, the more I'm interested in it. It's not a very strong departure from Objective C : in fact, it's even build on top of a lot of the C stuff that Apple push in the past, like GrandCentral, Cocoa... With nice improvement like an interactive environment (the playground). Objective C interop seem to guarantee interop with C and C++ - so no loss on this front. In fact, most of the pattern that we come to love (and hate) in the Objective C language are here : protocol and categories (class extension, nameless), delegate, kvo... but with gain coming from the type inference, better ARC integration (woot, no stopping Garbage Collector here), more easy subscripting.

In fact, the more I look at it, the more it look like an evolution over Objective C and the less it look like a revolution. This saddens me a little, we can have something better than that : here, it's the easy way out : a cleaned up C language, but nothing more. The REPL doesn't seem to be always available for example, it's still as dynamic as the Objective C (so not as much as Ruby or Python for example). It look a lot like a compiled Ruby or Python in fact, but coming to us way after the fact. But it's pragmatic, and this is something we can already use right now.

I know why they give us that now : to help the platform get more popular with people more into higher level language than C or Objective C, with a syntax more palatable for them. Still, it feel like computer science deserve better than that, a bigger leap (maybe of faith). I hope the guys from Lighttable will show us something sooner than later that demonstrate this idea - Chris Granger hint a lot at that with the Project Aurora. That's what I was hoping from Apple : that they think different.