Thursday, July 06, 2006

Oh!bjective C

So I had a shocking experience last night --- I saw how Apple's OS is written in Objective C, which is dynamically-typed C with Smalltalk syntax sans an automatic GC... and how their development tools look like the browser, the workspace, the UI painter, .bos files, the PDP debugger...

And if it wasn't enough, F-Script even gets rid of the square brackets around every message send, uses := for assignment, and provides an automatic GC for you.

Oh, by the way, there are blocks.

Since all of the OS is written the same way, the OS and all the apps that use these frameworks are accessible from your Objective-C program in a standard way. If you add behavior to the framework, it becomes accessible without restarting.

Maybe you can explain the .NET fantasy to me one more time, but I do not need to hear it again.

Why, exactly, do I still use Windows machines?!


Mark Aufflick said...

I have come the other way - I have made a gradual migration from Perl to Objective-C (on a Mac) with a little Ruby, until I found Smalltalk!

But yes, if you want to make shippable applications, then Objective C with the Cocoa frameworks is a seriously sweet environment. Very hard to beat.

And did you know that in the Xcode debugger there's a feature where you can edit code in situ and continue. (Waits for you to get back onto your chair...) Not bad for a compiled language! Thanks to the ObjC runtime you can also despatch method calls (messages in ObjC speak) at runtime with no class restriction. I think that's what won me in the first place. Here is a compiled language, with a serious framework, that I can do all the runtime stuff I love doing in Perl.

Andres said...

Thanks for your comments!

I am happy you're enjoying those features. Although I have to say...

... I liked Objective C because, since it was modeled after Smalltalk, it has the features already present in Smalltalk --- such as the debugger is also a browser and an inspector.

The thing is that Smalltalk is also a compiled language. What it has in common with Objective C is that message sends are not bound by the compiler at compile time. Rather, message sends are resolved when and only when they occur.

But there is more than just the tools. For example, when I first saw that NSObject implemented #doesNotUnderstand: in terms of #doesNotRecognizeSelector:, I realized how easy it was going to be to become fluent in this new environment.

Seriously. Objective C is a Smalltalkified C. Great stuff to build an OS on top of :). Go Objective C Go!