[Top][All Lists]

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

Re: Backtrace and enhanced catch

From: Ludovic Courtès
Subject: Re: Backtrace and enhanced catch
Date: Mon, 16 Jan 2006 09:38:47 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)


Better late than never...  ;-)

Neil Jerram <address@hidden> writes:

> Another (lesser) problem with lazy-catch and with-exception-handler is
> that they are always used in practice in a particular pattern.  For
> lazy-catch the pattern is
>   (catch tag
>     (lambda ()
>       (lazy-catch tag thunk lazy-handler))
>     catch-handler)
> For with-exception-handler the pattern (as shown by all the examples
> in SRFI-34) is
>   (call/cc
>     (lambda (k)
>       (with-exception-handler
>         (lambda (obj)
>           ...
>           (k 'exception))
>         thunk)))
> Why is this a problem?  Because it strongly suggests that these forms
> are more general than is useful.  And there is a cost to this: a bit
> more typing in Scheme, and in the case of Guile a lot more complexity
> in the C code needed to set up a catch and lazy catch pair (which is
> relevant to the backtrace problem).

OTOH, this would suggest that `lazy-catch' and `call/cc' are all we need
to implement `catch'.  This is probably the reason why SRFI-34 defines
no construct equivalent to `catch'.

>From a theoretical viewpoint, it seems to me that it would make sense to
just keep `lazy-catch' as a primitive and have `catch' implemented as a
macro on top of it.  Now, from Guile's implementation viewpoint, I guess
it would be much more costly/complex as you said.

Anyway, thanks for your patch: it's nice to see this issue is going to
be fixed! ;-)  And sorry for not replying earlier.


reply via email to

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