[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Scheme-reports] `guard' is crazy
- To: scheme-reports <scheme-reports@x>
- Subject: [Scheme-reports] `guard' is crazy
- From: Andy Wingo <wingo@x>
- Date: Sat, 05 Jan 2013 21:03:35 +0100
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.
Andy
--
http://wingolog.org/
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports