
Lauri Alanko wrote (on 20-12-02 11:26 +0200):
For what it's worth, I will probably be doing my MSc thesis on adapting eval (and reflection in general) to a statically typed language. Essentially you need a run-time representation of the environment and the typing context, and a type system which groks the relationship between run-time and static types.
Strangely enough, I haven't found any real research on this particular subject. There's lots of work on related areas, eg. dynamic types and intensional polymorphism, but nothing that's really motivated by eval and reflection.
Any suggestions for references are welcome. :)
There is quite a bit of work on staged evalution, metaprogramming, quasiquotation, reflection and run-time code generation in typed and ML-like languages. It's a very active and, IMO, promising area of research. Here is just a sample. Just follow the bibliography trail, or use CiteSeer: Rowan Davies and Frank Pfenning. A modal analysis of staged computation. In POPL '96, pp. 258-270, 1996. Jean Goubault-Larrecq. Logical Foundations of Eval/Quote Mechanisms, and the Modal Logic S4. http://citeseer.nj.nec.com/goubault-larrecq97logical.html MetaML homepage http://www.cse.ogi.edu/PacSoft/projects/metaml/ Walid Taha. Multi-Stage Programming: Its Theory and Applications. PhD thesis, OGI, 1999. MetaOcaml http://www.cs.rice.edu/~taha/MetaOCaml/ (also see Related Systems at the bottom of this page) Tim Sheard and Simon Peyton Jones. Template Meta-programming for Haskell. Haskell Workshop, Pittsburgh, October 2002. Mark Shields, Tim Sheard and Simon Peyton Jones. Dynamic Typing as Staged Type Inference. POPL '98. Eugenio Moggi et al. An Idealized MetaML: Simple, and More Expressive. ESOP '99. Pierre Leleu. A Modal Lambda Calculus with Iteration and Case Constructs. http://citeseer.nj.nec.com/leleu97modal.html Philip Wickline, Peter Lee and Frank Pfenning. Run-time Code Generation and Modal-ML. PLDI '98. Hope this helps! Regards, -- Frank