Using MetaML: A Staged Programming Language

  • Tim Sheard
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1608)


The purpose of staged programming in general, and MetaML in particular, is to produce efficient programs. We wish to move beyond programs that compute the “correct” output, to those that also have better control over resources (both space and time). The mechanism for doing this is to use program annotations to control the order of evaluation of terms. It should come as no surprise to those who have studied the λ-calculus that the number of steps in a reduction is strongly influenced by the order of evaluation. Since the number of steps in a reduction relates strongly to the resources it consumes, controlling evaluation order gives programmers better control over resources consumed. MetaML allows programmers to move beyond a fixed evaluation strategy, and to specify precisely the desired evaluation order.


Partial Evaluation Reduction Rule Elimination Rule Type Constructor Code Pattern 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Consel, C., Danvy, O.: Tutorial notes on partial evaluation. In: 20th ACM Symposium on Principles of Programming Languages, pp. 493–501 (January 1993)Google Scholar
  2. 2.
    Dershowitz, N.: Computing with rewrite systems. Information and Control 65, 122–157 (1985)zbMATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    Jones, M.P.: A system of constructor classes: Overloading and implicit higherorder polumorphism. In: FPCA 1993: Conference on Functional Programming Lan- guages and Computer Architecture, Copenhagen, Denmark, pp. 52–61. ACM Press, New York (1993)CrossRefGoogle Scholar
  4. 4.
    Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. In: Hoare, C.A.R. (ed.). International Series in Computer Science, Prentice Hall International, Englewood Cliffs (June 1993). ISBN number 0-13-020249-5 (pbk)Google Scholar
  5. 5.
    Launchbury, J., Peyton-Jones, S.: Lazy functional state threads. In: PLDI 1994: Programming Language Design and Implementation, Orlando, Florida, pp. 24–35. ACM Press, New York (1994)CrossRefGoogle Scholar
  6. 6.
    Martel, M., Sheard, T.: Introduction to multi-stage programming using metaml. Technical report, OGI, Portland, OR (September 1997)Google Scholar
  7. 7.
    Odersky, M., Läufer, K.: Putting type annotations to work. In: Proc. 23rd ACM Symposium on Principles of Programming Languages, pp. 54–67 (January 1996)Google Scholar
  8. 8.
    Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1998)CrossRefGoogle Scholar
  9. 9.
    Plotkin, G.D.: Call-by-name, call-by-value- and the lambda-calculus. Theoretical Computer Science 1, 125–159 (1975)zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Sabry, A., Wadler, P.: A reflection on a call-by-value. ACM Transactions on Programming Languages and Systems 19(6), 916–941 (1997)CrossRefGoogle Scholar
  11. 11.
    Taha, W., el-abidine Benaissa, Z., Sheard, T.: The essence of staged programming. Technical report, OGI, Portland, OR, 236 (December 1997)Google Scholar
  12. 12.
    Taha, W., Sheard, T.: Multi-stage programming with explicit annotations. In: Proceedings of the ACM-SIGPLAN Symposium on Partial Evaluation and semantic based program manipulations PEPM 1997, pp. 203–217. ACM, New York (1997)CrossRefGoogle Scholar
  13. 13.
    Taha, W., Sheard, T.: Metaml: Multi-stage programming with explicit annotations. Theoretical Computer Science, To Appear. 236Google Scholar
  14. 14.
    Wadler, P.: Comprehending monads. In: Proceedings of the ACM Symposium on Lisp and Functional Programming, Nice, France, pp. 61–78 (June 1990)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Tim Sheard
    • 1
  1. 1.Oregon Graduate Institute 

Personalised recommendations