Contents
Page-10
Prev
Next
Page+10
Index
Pitfalls of Partial Evaluation
There are practical difficulties with partial evaluation:
- To be successfully partially evaluated, a program must be
written in the right way. There should be good binding
time separation: avoid mixing static and dynamic data
(which makes the result dynamic).
(lambda (x y z) (lambda (x y z)
(+ (+ x y) z)) (+ x (+ y z)))
- The user may have to give advice on when to unfold recursive calls.
Otherwise, it is possible to generate large or infinite programs.
One way to avoid this is to require that recursively unfolding a
function call must make a constant argument smaller according to a
well-founded ordering. Branches of dynamic if statements
should not be unfolded.