Tutorial T1

Generative Programming and Component Engineering

Multi-stage Programming in MetaOCaml

This tutorial is CONFIRMED. Limited support is available for students, please contact taha@cs.rice.edu.


Despite their potential for improving reuse, abstraction mechanisms such as objects, abstract types, polymorphism, and higher-order types are all too often considered to have a prohibitive runtime cost. As a result, many real-world programs are littered with lost opportunities where these abstraction mechanisms could have been used to improve the quality of the code, but where they are considered prohibitively expensive. An important approach to dealing with this problem is program generation, which can be used to reduce or eliminate the runtime overhead of abstraction mechanisms. But writing program generators itself can be hard. Multi-stage programming (MSP) is a light-weight, semantically-motivated approach to making program generators easier to write. MetaOCaml is a programming language that provides special support for MSP by providing:

  • Hygienic quasi-quotation notation for distinguishing different computational stages (that is, the generating vs. the generated code) in a program, and
  • An evaluation construct that allows generated code to be generated and executed at runtime, and
  • A type system that statically ensures that this is done safely.

The full-day tutorial will cover

  • Small examples illustrating MSP
  • Cross-stage persistence
  • What the type system guarantees
  • MetaOCaml's libraries for collecting performance measurements
  • An application to language implementation (staged interpreters)
  • An introduction to binding-time improvements
  • An application to AOSD (aspect weavers)
  • An application to dynamic programming
  • An introduction to the MSP research literature

The tutorial will be presented by Walid Taha and Cristiano Calcagno. Active participation is encouraged. Slides from earlier offerings (2003 2004) of this tutorial give a good idea of its level. The new slides will be put online once they are available.


Vennaste saal

Date and Time

Tuesday, Sep. 27, 2005: 9.00 - 18.00 (full-day)


Walid Taha, Rice University, taha (at) cs.rice.edu

Cristiano Calcagno, Imperial College, ccris (at) doc.ic.ac.uk

Walid Taha and Cristiano Calcagno have lead the development of MetaOCaml since 1999. Walid and Cristiano have also been involved in the study of type systems for multi-stage languages since 1997.

Gpce05.TutorialT1 moved from Gpce05.TutorialGP1 on 13 Apr 2005 - 16:16 by AndrewMalton - put it back