Rob Arthan wrote:
- The example in the documentation doesn't quite work as stated. The problem
seems to be a general one: the only break-points seem to be at the head of a function (i.e., with the parameter bindings done, but not any bindings in let-expressions). When you go up the stack, values bound between the head of the function and the point of execution are not in scope. I.e., if you have something like:
fun f x = let y = h x; in g y end;
and break in g, when you go up to f, you can't see y (you can rerun the binding, but that may not be the right thing to do if h has side-effects).
It's even worse if the let-clause has a recursive call of f, e.g.
fun f 0 = 0 | f x = let val y = h (x, f (x - 1)); in g y end;
because you can't rerun the binding of h (x, f (x - 1)) to y since f is not bound in the debug environment provided at the head of itself.
I've had this problem on a few occasions and had to resort to making everything I need visible at the top-level and stepping through by manually following the execution and making the appropriate bindings.
I have since noticed that the manual, whilst describing the up and down operations, states `This is particularly useful for recursive functions.' I had to see the funny side...
Phil.