Showing posts with label ocaml. Show all posts
Showing posts with label ocaml. Show all posts

Monday, December 22, 2008

The Obscenity of New Syntax

Background

A couple of weeks ago, I attended the Lambda Lounge for a talk on OCaml. I decided to be proactive, so before the talk, I downloaded the runtime and kicked the tires.

For days, during compilations and Fit tests, I would play with the language. I had used ML years ago, but had forgotten much of it (aside from a vague memory of an ultra-strict, Klingon type system that was both a high-grade irritant, and yet oddly reassuring).

By the end of a week, I wasn't much further ahead with OCaml. I had written some basic functions and expressions, but nothing substantive.

The Experience

During the talk, I realized that the experimentation was more useful than I had imagined.

The presenter showed something like this:


# let sphere_surface = fun x -> x *. x *. pi;;
val sphere_surface : float -> float = fun

The questions flew immediately: why is there a double-semi (;;) ? are we running as root? how do we interpret the output?

These were natural questions by smart newbies to the language. I had two thoughts:
  • Naturally, it helps to prepare for a talk, but I was surprised by how far my modest time investment had taken me. I couldn't have answered all of the questions, but I could place myself in both mindsets: one of the questioner (what the heck?) and also the presenter (oh, see it works like this).
  • The first few examples struck the audience as obscene. I don't mean morally, and I don't mean that as a slight to OCaml per se. I mean in an artistic sense: well-known symbols that were beloved in other contexts had now been thrown together in a way that was jarring and almost repulsive. It takes some time to get past that shock of illiteracy.
The Upshot

This post is a reminder to myself: if a language talk is on the calendar, it is vital to download the environment and write some toy examples before attending, even if you only have a couple of hours to spare. The idea is not to learn the language but to embrace the obscenity and overcome it: celebrate the dissonance! As one music teacher put it: the Hendrix chord would have been considered hideous, even dangerous, in other eras. Now, it rocks.

Next Up: JavaFX

You may have several opportunities to see presentations on a new language in the near future: JavaFX. If you subscribe to the idea behind this post, you might be interested in an article by my friend Weiqi Gao: it is a top-shelf article on JavaFX as a language.

I'm going to be giving it a whirl over the holidays. The goal is to sing Auld Lang Syntax on New Year's Eve!

ps. Best holiday wishes to all readers... Here's a toast to a fine '09