[Top][All Lists]

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


From: Ludovic Courtès
Subject: Exceptions
Date: Mon, 26 Sep 2005 14:23:29 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)


Vorfeed Canal <address@hidden> writes:

> 2. No way to use standard (for modern languages like C++, PHP or Java)
> scheme with throw/catch and EXCEPTIONS HIERARCHY.


> About second problem. GNU Kawa (if we are talking about GNU GUILE it
> makes sense to borrow from GNU Kawa, right?) has the following
> solution to this problem:
> primitive-throw exception
>     Throws the exception, which must be an instance of a sub-class of
> <java.lang.Throwable>.

Well, this is the object-oriented approach to exceptions.  That doesn't
mean you can't obtain a similar result using Guile's current exception

In particular, the KEY arg passed to `throw' and `catch' can be thought
of as the ``class'' of the exception being thrown/caught.  One of the
additional arguments can be thought of as a subtype of the exception
(see, for instance, `system-error' and `system-error-errno').
Admittedly, this may sometimes be more verbose than the use of a class
hierarchy mechanism.

Fortunately, `guile-library' contains an implementation of SRFI-35's
hierarchical error conditions, and both `guile-library' and Guile (1.7)
implement SRFI-34's exception handling routines.  Only SRFI-36 (I/O
error conditions) is missing.

So I guess there's no valid reason not to use Guile.  :-)


reply via email to

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