Generative Programming and Component Engineering

Generative Programming and Component Engineering

Multi-stage Programming in MetaOCaml


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:

  • Heigenic 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 half-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 applicaiton to dynamic programming,
  • An introduction to the MSP research literature.

Slides and other updated information regarding this tutorial can be found at the official MetaOCaml tutorial web page.

Student Stipend

The National Science Foundation (NSF) has kindly provided a number of stipends to support student travel and participation to attend the MetaOCaml Tutorial and/or the MetaOCaml Workshop:

Awards will be made on the basis of relevance to the students education and research activities. To apply, please send an email to by September 5th. The email should include:

      1. ) Primary interest (Tutorial or Workshop)
      2. ) Explanation of relevance to your current educational and/or research goals (200-500 words)
      3. ) Secondary interest
      4. ) Explanation of relevance
      5. ) Estimated travel expense

Reimbursements will be made based on submitted expense receipts. Students submitting papers to the MetaOCaml Workshop are eligible for stipends. Amount of stipend will be indicated when you are notified of the result of your application.

Applications should be sent to by September 5th, 2004.


Conf. Ctr. Meeting Room 17

Date and Time

Sunday 1:30 - 5:00 (half-day)


Walid Taha, Rice University, taha (at)

Cristiano Calcagno, Imperial College, ccris (at)

Walid Taha and Cristiano Calcagno have been involved in 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. Walid has a record of organizing a number of successful workshops and conferences, including SAIG'00 (organizer and PC Chair), SAIG'01 (organizer and PC Chair), and GPCE'02 (General Chair).