Keep Working, Worker Bee!

3.23.2006

Quartz Composer: the world's most widely-used functional-reactive programming language

A couple days ago, Apple held a "Technology Update Briefing" here at University of Chicago. A "Technology Update Briefing," as it turns out, is where they send a developer around to demo all the cool new developer toys they've hidden away in Tiger, mostly in the XCode package you installed because you wanted GCC.

Our developer, Steve Hayman, pointed out a bunch of neat toys. He started out by pointing out a couple things I'm sure most developers who use Macs already know: for one thing, OS X has Unix inside and so you can use pipes if you want; and for another, the new Automator tool is a lot like a GUI's notion of piping (the robot is actually holding a pipe in reference to that). So far the talk was entertaining but didn't tell me anything I didn't already know.

But the next thing he pointed out was really new and totally cool: Quartz Composer. Quartz Composer is an application that comes with XCode on Tiger, so you've probably already got it installed (I did, anyway). What it does is allow you to build QuickTime objects, like movies and so on, by gluing together "patches" to create a pipeline, purely declaratively. Of course as far as Apple is concerned, it's a "visual programming environment" where you make graphical programs "without writing a single line of code", but of course that's not really where the sysmem's power comes from — you don't type in a single line of code, but as far as I'm concerned drawing lines between boxes on the screen and the other visual manipulation you do is just an incidental difference.

The real power of Quartz Composer is that it's purely declarative. If you want a bouncing ball, you don't write a loop that update's the ball's Y-coordinate once every however-many fractions of a second; you attach the ball's Y-coordinate input to the output of a low-frequency oscillator whose value depends on the time. If you want this morning's headlines from the BBC to show up on the screen, you make a text displayer and attach its text input to the output of an RSS feed monitor. If you want that text to follow your mouse around the screen, you attach its X- and Y-coordinates to monitors of your mouse's X and Y positions.

They never say it, but what they've implemented is functional-reactive programming, and by virtue of the fact that it's shipped with Tiger I'm willing to bet that it's the world's most widely-used FRP implementation. Furthermore, the Quartz Composer programs you can find online (for instance here) demonstrate that the approach scales way up.

2 Comments:

  • I found this ages ago when first installing the developer tools and spent a few happy hours tinkering with it, but I certainly didn't realise its potential!

    It's certainly very fiddle-with-able: you can't help but start mucking about with any examples you find online, from tweaking parameters to hooking up LFOs in unexpected places. The ability to use MIDI data also opens up intriguing possibilities...

    By Anonymous Narrenschiff, at 12:11  

  • FWIW, I don't think this is novel; IIRC, there are a bunch of systems / languages that have this design (drag a bunch of things onto the screen, hook them together with pipes), and they ALL have an FRP feel. In fact, I vaguely remember a game/PL for the Apple II that had this going on. Help me, Google!
    ...
    Yay, Google! The game was called "Rocky's Boots," and it included a bunch of gates that you could wire together, along with FRP-like event-generators (these could be the "clackers" mentioned by the wikipedia entry).

    So; nothing new here.

    By Anonymous John Clements, at 18:31  

Post a Comment

<< Home