On Sat, 11 Jul 2020 23:39:18 +0100 Chris Vine <vine35792...@gmail.com> wrote: > On Sat, 11 Jul 2020 14:20:22 -0400 > John Cowan <co...@ccil.org> wrote: > > Is the intention to provide `guard` in Guile 3.x? > > It's been in guile for as long as I can remember (at least since 2.0).
By the way, guile-3.0's version of 'guard' doesn't comply with R6RS/R7RS (I think Chez scheme's 'guard' is about the only one which does). After correction, R6RS and R7RS require the cond conditionals to be evaluated and the body of any cond clause to execute in the dynamic environment in which 'guard' was called. If there is no cond conditional evaluating to true and no else clause, then the dynamic environment reverts to that of the site of the exception for the exception to be re-raised by raise-continuable. guile doesn't do that, I think mainly for efficiency reasons. In guile-3.0, the cond conditionals are evaluated in the dynamic environment in which the exception arises, and only if there is a cond conditional evaluating to true (or an else clause) does control pass to the dynamic environment in which 'guard' was called for the relevant cond clause body to execute. So as with R6RS/R7RS, where an exception is re-raised, that is done by raise-continuable in the dynamic context in which the exception occurred, but a different route is chosen to get there. I prefer guile's approach but I imagine your view is probably different.