...Anyway, I can't help but think that there might be a happy medium
between eager and lazy evaluation.
What I'd love to see is the compiler continue to be call-by-need, but be smart enough to recognize when multiple expressions will all eventually need to be evaluated. A simple example:
show (a + b)
(+) requires *both* 'a' and 'b' be evaluated to show the result, not 'a' *then* 'b'. It'd be great if the compiler can seek out any shared lazy data structures in evaluating 'a' and 'b', and start computing them both with one element at a time.
Has anyone put any thought into something like this?
Thanks,
Greg