Categories
Programming

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.

3 replies on “Jackpot”

I know refactoring tools aren’t a new idea, but the idea hasn’t penetrated the real world far enough that I’ve ever had the opportunity to use one in my day job, for example. So I definitely like it when Microsoft or Sun people look seriously at these issues, even if they reinvent some wheels.

One thing about Gosling’s particular take that was new to me [no doubt its laughably old within the community on the above-linked forum (c:] is the amount of automation. It sounds like he wants the machine looking for bad smells in the AST and proposing/performing the necessary refactorings to remove them. As he puts it, “trying to couple analysis with action.” Since a lot of refactoring starts from an existing mess, this sounds like useful assistance.

I kind of like the idea that an analyser in my development environment might look at the existing tree, and notice ways to transform it to improve some metric related to simplicity or comprehensibility. It seems that the “best” architecture often evolves in fundamental ways within real-world codebases that are chasing a moving target. To the extent that a good architecture is one where classes map nicely to concepts, then such an analyser might even help me to usefully reconceptualize the problem that my code currently solves (and the way that it solves it.)

Comments are closed.