This is a Scheme-friendly (and Arc-friendly) approach to doing partial evaluation manually, as in doing minimal edits to straightforward code to turn it into a partial evaluation style. The manual aspect means you get to choose where to gloss over things like late binding that make Scheme and Arc unfriendly to partial evaluation in the general case. I wonder if someone here ( * cough akkartik or me cough * ) could extrapolate this to a more automatic process (by designing a less mutable language to use it in :-p ) or at least identify all the needed manual bits and turn them into unobtrusive (declare ...) forms.
The concept of partial evaluation in this article seems to be founded on expressions rather than continuations, so it might be more approachable than the way I think of it. Or maybe I'm the only one who'd jump to continuations for this, I dunno. :-p
"I have this pipe dream of being able to add optimizations from within lisp, without changing the underlying C."
Hmm, perhaps all such optimizations can be expressed as partial evaluation 'recipes'. I'm imagining that as you implement new forms you can also add separate recipes that control how to transform an expression before it's interpreted. It would need some sort of cache to make it economical. At that point you have a simplistic sort of JIT. Does any other language implementation do this sort of thing?
Thanks for the link! (I'm probably just stating the painfully obvious; bear with me as I wrap my head around it :)
"Does any other language implementation do this sort of thing?"
I have no clue. I'm sure there are languages that do partial evaluation, at least in a JIT way, but I don't know of anything that has JIT recipes, and yet there are some languages I don't understand well enough to say. XD
Particularly, if a language is meant for searching a formal system for a solution, like say a constraint programming system or a proof assistant which lets the user specify the problem and then specify tactics to use to solve it, the underlying implementation might have things in common with this recipe idea. I really don't know these languages, but there's probably a lot we could learn from them.
Another thing... I don't really understand Cristiansen grammars either (http://en.wikipedia.org/wiki/Adaptive_grammar#Christiansen_G...), but I feel like they probably have stuff in common with fexprs. A grammar is all about rewriting terms, which makes it like the rewriting language talked about in this partial evaluation article. In the case of a Cristiansen grammar, each term is bundled with its own set of grammar productions, which seems a lot like saying that each expression is bundled with the environment to evaluate it in.
Hope that helps. XD; My head's not wrapped around this stuff either.