unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: Guile Users <guile-user@gnu.org>, guile-devel@gnu.org
Subject: Re: GOOPS-based SRFI-35 implementation
Date: 06 Mar 2004 12:05:33 +0000	[thread overview]
Message-ID: <85llmerxiq.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <87n06xqx8c.fsf@ivanova.rotty.yi.org>

Andreas Rottmann <a.rottmann@gmx.at> writes:

> Neil Jerram <neil@ossau.uklinux.net> writes:
> 
> > Andreas Rottmann <a.rottmann@gmx.at> writes:
> >
> I've thought of this, too; this was my reason to use GOOPS in the
> first place.

Great - our thoughts are very much in sync then.  In my view, though,
the whole idea becomes much nicer and more useful if we integrate it
with existing Guile exceptions, so I hope we can agree with Marius to
do this.

> > 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).

Seems sensible; also that it doesn't exist in the SRFI, because
&compound-condition is not a condition _type_ (even though it does
make sense as a GOOPS class).  Do you have an example in mind of how
methods on &compound-condition can be useful?

I'm not sure though about `condition' expanding to
`make-compound-condition' in the case there is only one type given.
Is this implied in some way by the SRFI?  I think it would be nicer to
detect the single type case and use `make-condition' instead.

> 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))

(Not in the version that you posted, so I presume this is newer.)
Interesting.  I'm sceptical that it will be possible to define a
generally useful handler for a condition, but I could easily be wrong,
and there is negligible overhead from providing this.  (On the other
hand, it's only a few lines, so perhaps could be left to the
programmer to write for him/herself when needed?)

> > 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.

Hmm.  My inclination is that it would be nicer if a compound condition
straightforwardly satisfied is-a? for all its component condition type
classes (without specialization of is-a?).  

The big benefit of this is that methods defined for the component
types will work on (instances of) the compound type as well, which
makes sense because we know that the compound type has all the slots
of the component type.

The possible problem is that `make-compound-condition' would have to
construct an appropriate subclass on the fly, and that this should
interact nicely with compound condition classes created explicitly by
the programmer, e.g.:

(define-class &my-condition (&i/o-condition &runtime-condition)
  ...)

In other words, given this define-class, the result of

(make-condition &my-condition ...)

should be indistinguishable from that of

(make-compound-condition &i/o-condition (...)
                         &runtime-condition (...))
 
but I think this is achievable.

This conflicts, though, with the introduction of &compound-condition
and the idea that &compound-condition provides a way to define methods
on compound conditions.  Since this ability is a Guile extension
anyway (w.r.t. SRFI-35), I think it would be reasonable to say that
the way to do this is to define the compound condition class
explicitly, using define-class as just above.

Regards,
        Neil


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


  reply	other threads:[~2004-03-06 12:05 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
2004-03-06 12:05     ` Neil Jerram [this message]
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=85llmerxiq.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --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).