
A Gentle Introduction to Multi-Stage Programming [pdf] - dkarapetyan
http://www.cs.rice.edu/~taha/publications/journal/dspg04a.pdf
======
Drup
This is quite old. MetaOCaml has been rewritten since (the new version is
linked in another comment)

A better ressource to learn about multi stage metaprog in OCaml is Jeremy
Yallop's course on advanced functional programming:

See "staging" sections:
[https://www.cl.cam.ac.uk/teaching/1415/L28/materials.html](https://www.cl.cam.ac.uk/teaching/1415/L28/materials.html)

Interactive notebook:
[http://ocamllabs.github.io/iocamljs/staging.html](http://ocamllabs.github.io/iocamljs/staging.html)

~~~
scribu
I was confused by the fact that you only linked to the first notebook. There
are actually several notebooks related to staging in the course outline.

Anyway, thanks!

------
akkartik
Anytime I read about multi-stage I'm reminded of this absolutely fascinating
project to turn stage 0 code into stage 1 code: [https://scala-
lms.github.io](https://scala-lms.github.io)

------
pzh
Can somebody shed some light on how this is different from delayed/lazy
evaluation? I thought languages like Scala and Haskell already support these
patterns, but I haven't heard the term 'multi-stage' applied to them...

~~~
dkarapetyan
This is more like hygienic lisp macros, .net expression trees, jvm bytecode
generation, etc. You are generating and compiling code instead of just
deferring the evaluation to the last minute.

------
iso-8859-1
Note that the last release of MetaOCaml was in 2006. This paper is old too,
but I don't know exactly how old. But probably about 10 years.

~~~
banach
A re-implementation of MetaOCaml was released last year
([http://okmij.org/ftp/ML/MetaOCaml.html](http://okmij.org/ftp/ML/MetaOCaml.html)).

