[Scheme-reports] `guard' is crazy Andy Wingo (05 Jan 2013 20:04 UTC)
Re: [Scheme-reports] `guard' is crazy Alex Shinn (06 Jan 2013 02:48 UTC)

[Scheme-reports] `guard' is crazy Andy Wingo 05 Jan 2013 20:03 UTC

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@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports