How Tim Burks and Nu Stole the Show at C4[1]

August 12, 2007

Edit: Fixed some factual inaccuracies about the language itself.

Tim Burks, noted contributor to RubyCocoa and creator of RubyObjC, gave a talk at C4[1] about his experiences with creating a Ruby <-> ObjectiveC bridge, and the problems he overcame in doing so. It was an interesting presentation, and we were all suitably appreciative when he showed his custom visual chip-design software written in Ruby with a Cocoa interface.

And then he dropped a bombshell.

For the past year, Tim’s been working on a new dialect of Lisp – written in Objective-C – called Nu. Here are its features (more precisely, here are the ones that I remember; I was so awestruck that many went over my head):

  • Interpreted, running on top of Objective-C.
  • Scheme-y syntax. Everything is an s-expression (data is code, code is data). Variable assignment was done without let-clauses (which are a pain in the ass) – all one has to do was (set varname value).
  • Variable sigils to indicate variable scope.
  • True object-orientation – everything is an object.
  • True closures with the do-statement – which, incidentally, is how Ruby should have done it.
  • Macros. HOLY CRAP, MACROS! When Tim showed us an example of using define-macro for syntactical abstraction, Wolf Rentzsch and I started spontaneously applauding. His example even contained an example of absolutely beautiful exception handling that should be familiar to anyone with any ObjC or Ruby experience.
  • Symbol generation (__) to make macros hygenic and prevent variable name conflicts.
  • Nu data objects are Cocoa classes – the strings are NSStrings, the arrays NSArrays, etc.
  • Ability to create new Obj-C classes from inside Nu.
  • Interfaces with Cocoa libraries – you can access Core Data stores from within Nu in a much easier fashion than pure ObjC, thanks to Tim’s very clever idea of using a $session global to store the NSManagedObjectModel, NSManagedObjectContext, and NSPersistentStoreCoordinator.
  • Ruby-style string interpolation with #{}.
  • Regular expressions.
  • Positively drool-inducing metaprogramming, including a simulation of Ruby’s method_missing functionality.
  • A web-based templating system similar to ERb in 80 lines of Nu code – compare that with the 422 lines of code in erb.rb.

Tim showed us a MarsEdit-like blog editor written entirely in Nu, using Core Data as its backend – and then showed us the built-in Nu web server inside that program, complete with beautiful CSS/HTML/Ajax.

As F-Script is to Smalltalk, so Nu is to Lisp. Tim said that he hopes someday to open-source Nu; if he does, he will introduce what is quite possibly the most exciting development in the Lisp-related community in a long time. I don’t think I speak for just myself when I say I cannot wait to get my hands on it.

Entry Filed under: apple, c, cocoa, code, fp, functional, gui, nifty, nu, objc, programming, ruby. .

4 Comments

  • 1. Victoria  |  August 27, 2007 at 2:03 am

    Thanks for the great summary!

  • 2. ken  |  August 28, 2007 at 6:19 am

    Yes, thank you, very informative. Here’s waiting for Nu!

  • 3. john  |  October 23, 2007 at 1:00 pm

    I just hope Tim would have taken the same approach and created a new closely Objective-C based Ruby intepreter. Lisp mindset does not have anything to do with the real-world programmer mindset. Sorry.

  • 4. ringo  |  July 28, 2008 at 8:04 pm

    Many thanks to Tim Burks and Laurent Sansonetti, both working very hard on alternative/complement solutions to Objective-C for building full-fledged Mac OS X applications.

    MacRuby and NU are each one good candidates to overcome the limitations of RubyCocoa and RubyObjC.

    Tim Burks contribution to RubyCocoa was instrumental and I am just hoping Tim will also contribute on MacRuby works.

    By the way, the IC netlist routing app. Tim demonstrated at C4 is simply fantastic !


About Me



I'm Patrick Thomson. I'm a sophomore at George Washington University, passionate about technology, Apple, and programming in Cocoa, Python, Ruby, and Nu.

Why "important shock"? It's an anagram of my name.

Meta

Blogroll

a

Top Posts

Blog Stats