Jackpot

James Gosling is talking about his latest language project, Jackpot. It appears to be a combination of two things – “let’s edit AST’s instead of ASCII source code” and a mini theorem-prover which understands dataflow.

A few years ago, Microsoft were onto a similar thing with their Intentional Programming research project, which has since been wiped off the face of the net (except for this spinoff company and a chapter in the “Generative Programming” book).

When you run a traditional compiler, it reads in your ascii source code and analyses it to form an information-rich representation. It knows all the types, where each variable is declared and used, whether a line of code is reachable or not. It needs to know all this information before it can generate the assembly version of your program. But that same information would be very useful to developers too.

In a system like DevStudio, there’s a big wall between your text editor and the compiler. You throw your source code over the wall to the compiler, and some time later it throws you back a .obj file. It can also throw you back a dump of some of the information it figured out (“browse information”). That doesn’t work so well, because whenever you start editing code, the information gets out of date.

What systems like IP and Jackpot do is move the wall. Now, on one side you have your editor and the “information gathering” engine. On the other side you have a code generator which uses the gathered information. This means that your editor can use knowledge of the semantics of the language to enhance it’s editing factilities and presentation of your code. You can do neat editing things like having each appearance of a particular variable name be linked together, so that if you select one and edit it, they all change together. You can redefine the input mechanisms to use customized notations. You can neat visualization thing such as converting sqrt(x) into the mathematical symbol for square root, or converting a complication boolean expression into a circuit diagram with AND, NOT, OR gates. In IP, you can also define reduction methods which transform your code – the idea being that you can define a high-level notation (which you’ll then use day-to-day) and a set of reduction methods which map those high-level constructs onto something more efficient.

The “big idea” is that code should express the intention of the programmer rather than being an abstraction of machine code. This is also a goal of declarative languages and domain-specific languages.

How to spend time

I’ve got to the start where I’ve abandoned too many personal programming projects. Now I’m loathed to start any new ones unless it’s going to be really signficant.

I can think of three reasons for doing a project – to create something, to learn something, or because you’ve got nothing better to do.

Creating something is the raison d’etre of programming. Creating something new is great. Pushing the envelope, exploring new ground. Finding a more efficient, elegant or more general solution to an already solved problem is great. In contrast, reinventing the wheel is loathsome. Writing Yet Another Window Manager or Yet Another Text Editor should a hangable offence.

Having said that, writing programs for your own education is part of the ongoing process of improvement which any programmer should pursue. Writing a garbage collector yourself is probably the best way to learn about them. But I try hard to limit the scope of “learning programs” because otherwise you can spend weeks on irrelevant details.

The last reason – “because you’ve nothing else to do” – is the worst reason for sitting programming a computer. Directionless wandering will suck hours from your life, and at the end you’re only tired rather than wise.

So, I’ve written substantial, yet incomplete, portions of DTP programs, compiler backends. I’ve written too many raytracers, mostly as a way of learning a new language. They’re complex enough to explore the language and tools adequately, but I know how to write one from memory.

LL2

I’m working my way through the videos from the Lightweight Languages 2002 (LL2) conference at MIT. Yay, for digital videos of conferences! Boo, for doing it in RealVideo format. This isn’t just because I can’t archive it locally, but also because there isn’t terribly much action to watch. Most of the time, the camera focuses on the presenter’s slides, which appear blurry and pixelated after the RealVideo codec has squished them. I look forward to the day when SMIL or some other integrated multimedia solution allows us to mix audio/text/html/pdf/video in a syncronized stream. It would be a great boost for online learning.

Anyhow, I’ve just watched Matthew Flatt’s presentation in which he plays with the distinction between programming languages and operating systems. He makes the point that safe languages (such as ml, where the type system guarantees that you won’t suffer pointer errors) remove at least some of the reasons for having processes occupying seperate address spaces. Unlike in C++, an ML program will never scribble over the end of a heap block. So, if your citizens are well enough behaved, they can all live in the one house together.

Hmm, must leave to get to band practise now …

Hardware, for once

A few years ago, I dabbled in hardware by building a programmer and test circuit using the PIC microcontroller. At the time, I wished that I had a digital camera so that I could put up a webpage. Well, four years have passed and I finally have a digital camera, so here it is.

I think building these circuits exorcised my hardware daemons. I feel no further need to build “little computers” (which was what Susan’s mum would call it). Normal service will be resumed shortly.