From: Andreas Rottmann <a.rottmann@gmx.at>
Cc: Guile Users <guile-user@gnu.org>, guile-devel@gnu.org
Subject: Re: GOOPS-based SRFI-35 implementation
Date: Thu, 04 Mar 2004 01:20:19 +0100 [thread overview]
Message-ID: <87n06xqx8c.fsf@ivanova.rotty.yi.org> (raw)
In-Reply-To: <853c8paphg.fsf@ossau.uklinux.net> (Neil Jerram's message of "03 Mar 2004 16:02:03 +0000")
Neil Jerram <neil@ossau.uklinux.net> writes:
> Andreas Rottmann <a.rottmann@gmx.at> writes:
>
>> Hi!
>>
>> I just wanted to announce that I've been working a bit on a
>> GOOPS-based implementation of SRFI-35 ("Conditions"). It seems to
>> basically work, except compound conditions, which are not-yet
>> implemented. My implementation is based on the SRFI reference
>> implementation, but differs a good deal because it uses GOOPS classes
>> instead of SRFI-9 ("Defining record types").
>
> Without having looked yet at your code, I think this is nice, because
> it ties in with my general thoughts on how we might enhance Guile's
> existing errors and exceptions and unify them with the proposals in
> SRFIs 34, 35 etc.
>
> So perhaps this is a good time to share and discuss those thoughts.
> In my view there are two main problems with Guile's current
> errors/exceptions.
>
> - A given error/exception - i.e. a collection of throw args - is not
> at all self-describing as regards how the catcher should deal with
> it, print an error message, etc.
>
> - There is no way to say sthg like "I want to catch all system
> errors", or "all numerical erros".
>
I've thought of this, too; this was my reason to use GOOPS in the
first place.
> I think the solution to both these is that an error/exception should
> be an instance of a GOOPS error/exception class (+ subclasses). The
> first problem is then solved by the class slots showing what
> information is available about the error/exception, and class methods
> to - for example - print a human-readable message describing the
> error/exception.
>
So far, this is all implemented in my srfi-35 stuff as in my
Archive. I have additionally exported a handle-condition generic,
whose methods call (error "unhandled foo"), foo being an error
condition, message, serious condition. Also, there is a class
&compound-condition which doesn't exist in the SRFI (so methods for
compund conditions can be defined). Plus, there is a macro
guard/handle, which calls handle-condition:
(define-method (handle-method (&foobar-condition c))
...)
(guard/handle
(some-code-that-maz-be-foobar))
> The second problem is solved by arranging
> error/exception classes in an inheritance hierarchy, and enhancing
> `catch' so that it catches all errors/exceptions that satisfy `(is-a?
> KEY)'.
>
First part (inheritance hierarchy) also done.
> If this is accepted, I further think that the errors/exceptions in the
> new class hierarchy should be identical with the conditions specified
> by SRFI-35. Therefore, for example, `make-condition' would create and
> return a GOOPS error/exception class and, given a
> error/exception/condition object OBJ, `(condition-has-type? OBJ TYPE)'
> would be identical to `(is-a? OBJ TYPE)'.
>
I'd have to specialize is-a? for this, since compound conditions all
share a class.
> Even further, I think it follows that `throw' can become identical to
> SRFI-34's `raise', with back-compatibility preserved by translating
>
> (throw KEY . ARGS)
>
> to something like
>
> (throw (make <legacy-exception> #:key KEY #:args ARGS))
>
> Finally, `catch' could be enhanced so that its KEY is either #t, a
> symbol (legacy case) or an error/exception class; and SRFI-34's
> `with-exception-handler' and `guard' provide different catching and
> handler semantics, but operating on the same kind of
> error/exception/condition objects.
>
> Any comments?
>
Sounds like a good plan, especially since it's been about that what I
was after ;-)
Cheers, Andy
--
Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at
http://yi.org/rotty | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62
Python is executable pseudocode, Perl is executable line-noise.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2004-03-04 0:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-28 15:53 GOOPS-based SRFI-35 implementation Andreas Rottmann
2004-03-03 16:02 ` Neil Jerram
2004-03-04 0:20 ` Andreas Rottmann [this message]
2004-03-06 12:05 ` Neil Jerram
2004-03-06 14:52 ` Andreas Rottmann
2004-03-08 20:07 ` Andreas Rottmann
2004-03-10 9:17 ` Neil Jerram
2004-03-11 15:38 ` Mikael Djurfeldt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87n06xqx8c.fsf@ivanova.rotty.yi.org \
--to=a.rottmann@gmx.at \
--cc=guile-devel@gnu.org \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).