archives

Metaprogramming with Traits

Metaprogramming with Traits, Aaron Turon and John Reppy. ECOOP 2007

In many domains, classes have highly regular internal structure. For example, so-called business objects often contain boilerplate code for mapping database fields to class members. The boilerplate code must be repeated per-field for every class, because existing mechanisms for constructing classes do not provide a way to capture and reuse such member-level structure. As a result, programmers often resort to ad ho code generation. This paper presents a lightweight mechanism for specifying and reusing member-level structure in Java programs. The proposal is based on a modest extension to traits that we have termed trait-based metaprogramming. Although the semantics of the mechanism are straightforward, its type theory is difficult to reconcile with nominal subtyping. We achieve reconciliation by introducing a hybrid structural/nominal type system that extends Java's type system. The paper includes a formal calculus defined by translation to Featherweight Generic Java.

This paper explains how to scratch an itch I've had for a long, long time -- uniformly generating groups of fields and methods, including computation of the field/method names. Something like this would be quite useful in an ML-like language's module system, too.

LtU beer party - Jerusalem

It turns out thaty both Luke and me are in Jerusalem at the moment (well, I am usually there)! Luke is here until the end of August, and we want to have a little meeting for LtU members and friends.

If you want to join us for drinks and discussion of esoteric languages let me know (please suggest dates, and mention any special food/drinks requirements if you have them).

Google Python Sprint 2007

Joining this event (August 22-25) or following the action from afar may be a good way to keep up with Python 3000.

The first alpha release (3.0a1) should be just around the corner.

Computing Kazhdan-Lusztig-Vogan Polynomials for E8

This is not a PLT paper, but I found the programming adventures of mathematicians trying to compute the Kazhdan-Lusztig polynomials for E8 very interesting: The Character Table for E8 by David Vogan. The software part begins on page 9.

I wish he had expanded on the following (emphasis mine in bold):

So late in 2004, Fokko began to add to his software an implementation of the Kazhdan-Lusztig algorithm for real groups. The papers in which this algorithm is formulated are extremely dense, and written with no consideration for computational practice. An expert could easily spend many months just to understand the mathematical statements. Fortunately, Jeff Adams had been working on a new formulation of Theorem 6 (parametrizing irreducible representations), growing out of earlier work that he did with Dan Barbasch and me. Jeff's formulation seemed suited to computer implementation; he had been working with Fokko to make it more so.

Over the course of the next year, Fokko understood the Kazhdan-Lusztig algorithm for real groups, recasting it in the language that he and Jeff had developed. He wrote clear and efficient code to implement it. In November of 2005 --incredibly soon!-- he finished. Very quickly he and Jeff used the software to compute Kazhdan-Lusztig polynomials (and so character tables) for all of the real forms of F4, E6, and E7, and for the non-split form of E8.