guile-user
[Top][All Lists]
Advanced

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

Re: "Missing" libraries/concepts found in other languages/ecosystems?


From: Chris Vine
Subject: Re: "Missing" libraries/concepts found in other languages/ecosystems?
Date: Mon, 13 Jul 2020 11:10:05 +0100

On Sat, 11 Jul 2020 23:39:18 +0100
Chris Vine <vine35792468@gmail.com> wrote:
> On Sat, 11 Jul 2020 14:20:22 -0400
> John Cowan <cowan@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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]