Hi,

Better late than never...  ;-)

Neil Jerram <[EMAIL PROTECTED]> 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.

Ludovic.



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

Reply via email to