Wed Aug 26 10:14:35 CEST 2009

Lazy partial evaluation

The cool thing about a concatenative language (or any purely
functional formulation) is that it allows lazyness, and your `compile
time' becomes completely arbitrary, because the order of evaluation
makes no difference.  In a concatenative language this is a lot easier
to express than in the lambda calculus: it's just the associativity
law of the syntactic/semantic monoids.

Now, in practice however, you do want side-effects as `external
input'.  (In Staapl's low-level Forth-like language this also
includes memory operations.)

Moral: you can't fully reduce to a value: some of that needs
to be done in a 2nd stage, the program's run-time.  This re-introduces
compilation, but as a real staging / partial-eval operation.

It points the finger to the sour spot too: what I want in Staapl is
really this lazy semantics.  The current eager approach is an
approximation that makes the evaluator easier to get right, but it's
probably a dead end in that the neat tricks lazyness allows won't be

Some relevant links:

[1] http://thyer.name/phd-thesis/
[2] http://lukepalmer.wordpress.com/2009/05/04/lazy-partial-evaluation/