[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Scheme-reports] `guard' is crazy

I've said it before but it's worth repeating: "guard" is not a good
error handling construct.  The reason is that it unrolls the stack and
dynamic extent down to its handler, and then if the handler doesn't
handle the error, it rolls it back up to the `raise' and continues the
error dispatch.

Running dynamic-wind guards, particularly re-entry guards, is not
something that you want to do while handling an error.

There is a simple solution: run the test expressions of a `guard' clause
in the dynamic environment of the `raise', and if it matches, roll down
and run the body in the dynamic environment of the `guard'.

As it is, I will never use `guard' in my code.


Scheme-reports mailing list