This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Q: throw and catch


Klaus Schilling <Klaus.Schilling@munich.netsurf.de> writes:

> Mikael Djurfeldt writes:
>  > Here's one.  Note, though, that Guile's catch takes a third handler
>  > argument as well.
> 
> What was the original reason why guile's catch/throw mechanism differs
> from the one of emacs lisp?

I don't know, but note that Guile's catch is one construct which
supports two different uses:

1. catch/throw

2. catching exceptions

Presumably this was perceived as smart.  I'm not so sure that it is
smart, though, because if you have two different usage patterns, with
different needs, it is probably better to have one programming
language construct adapted for each pattern.

Another perspective is that by having one mechanism one can make
libguile smaller, but, in this case, the difference isn't noticeable
relative to the current size of libguile.

But note that it is possible to emulate Emacs' catch with Guile catch:

(define (emacs-catch tag thunk)
  (catch tag thunk (lambda (tag value) value)))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]