archives

Proper tail reflection?

I was reading some papers on reflective towers, and it occurred to me that levels in the towers look suspiciously similar to recursive calls (well, it was actually openly proclaimed by the authors, so probably "occurred" is not the right word).

For example, from A Tutorial on Behavioral Reflection and its Implementation:

In the same way well-defined recursions never require an infinite number of recursive calls, a well-defined reflective program never uses an infinite number of embedded reflective procedure calls.
What really occurred to me, why not give to reflective levels some kind of TCO?

After a minute's joy, I decided to consult Google, and found this:

Intensions and Extensions in a Reflective Tower:

The key points obtained here are: a formal relation between the semantic domains of each level; a formal identification of reification and reflection; the visual- isation of intensional snapshots of a tower of inter- preters; a formal justification and a generalization of Brown's meta-continuation; a (structural) denotational semantics for a compositional subset of the model; the distinction between making continuations jumpy and pushy; the discovery of the tail-reflection property; and a Scheme implementation of a properly tail-reflective and single-threaded reflective tower.
So, on a negative side, somebody (actually, Danvy) discovered this long ago; on a positive side, I can now read it :)