<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[Important Shock]]></provider_name><provider_url><![CDATA[https://importantshock.wordpress.com]]></provider_url><author_name><![CDATA[Patrick Thomson]]></author_name><author_url><![CDATA[https://importantshock.wordpress.com/author/importantshock/]]></author_url><title><![CDATA[How Tim Burks and Nu Stole the Show at&nbsp;C4[1]]]></title><type><![CDATA[link]]></type><html><![CDATA[<p><em>Edit: Fixed some factual inaccuracies about the language itself.</em></p>
<p><a href="http://blog.neontology.com/">Tim Burks</a>, noted contributor to <a href="http://rubycocoa.sourceforge.net/">RubyCocoa</a> and creator of <a href="http://www.rubyobjc.com/">RubyObjC</a>, gave a talk at <a href="http://c4.rentzsch.com/">C4[1]</a> about his experiences with creating a Ruby &lt;-&gt; 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.</p>
<p>And then he dropped a bombshell.</p>
<p>For the past year, Tim&#8217;s been working on a new dialect of Lisp &#8211; written in Objective-C &#8211; called <a href="http://blog.neontology.com/posts/2007/08/11/whats-nu">Nu</a>. Here are its features (more precisely, here are the ones that I remember; I was so awestruck that many went over my head):</p>
<ul>
<li>Interpreted, running on top of Objective-C.</li>
<li>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) &#8211; all one has to do was <code>(set varname value).</code></li>
<li>Variable sigils to indicate variable scope.</li>
<li>True object-orientation &#8211; everything is an object.</li>
<li>True closures with the do-statement &#8211; which, incidentally, is how Ruby should have done it.</li>
<li><span style="font-weight:bold;" class="Apple-style-span">Macros. HOLY CRAP, MACROS!</span> When Tim showed us an example of using <code>define-macro</code> 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.</li>
<li>Symbol generation (__) to make macros hygenic and prevent variable name conflicts.</li>
<li>Nu data objects are Cocoa classes &#8211; the strings are NSStrings, the arrays NSArrays, etc.</li>
<li>Ability to create new Obj-C classes from inside Nu.</li>
<li>Interfaces with Cocoa libraries &#8211; you can access Core Data stores from within Nu in a much easier fashion than pure ObjC, thanks to Tim&#8217;s very clever idea of using a $session global to store the NSManagedObjectModel, NSManagedObjectContext, and NSPersistentStoreCoordinator.</li>
<li>Ruby-style string interpolation with #{}.</li>
<li>Regular expressions.</li>
<li>Positively drool-inducing metaprogramming, including a simulation of Ruby&#8217;s <code>method_missing</code> functionality.</li>
<li>A web-based templating system similar to ERb in 80 lines of Nu code &#8211; compare that with the 422 lines of code in erb.rb.</li>
</ul>
<p>Tim showed us a MarsEdit-like blog editor written entirely in Nu, using Core Data as its backend &#8211; and then showed us the built-in Nu web server inside that program, complete with beautiful CSS/HTML/Ajax.</p>
<p>As <a href="http://www.fscript.org/">F-Script</a> 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&#8217;t think I speak for just myself when I say I cannot <em>wait</em> to get my hands on it.</p>
]]></html></oembed>