This is the mail archive of the guile-gtk@sources.redhat.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]
Other format: [Raw text]

Re: GError


Hi Kevin,

On Mon, 26 May 2003, Kevin Ryde wrote:

> Andy Wingo <wingo@pobox.com> writes:
> >
> > With regards to GError, I think the solution you propose is too much
> > like C programming.
> 
> Oh, well, if it's nice and close then at least people familiar with
> the C style will find the guile interface comfortingly similar.  Or
> vice versa even.

I'm not sure that an identical function mapping is really a goal. I am
programming in scheme because I prefer it to C. In making these
bindings, the goal has been to make the functionality of the gnome APIs
available from scheme, not strict API transliteration. I don't think
throwing exceptions will bother anyone who chooses scheme over C.

A quick search through gnome/defs shows the following occurences of GError:

 * Gdk: 7 uses, all regarding file i/o (pixbuf loading and saving,
   mostly)
 * Pango: 1 use, pango_parse_markup
 * GConf: a boatload of uses, for a boatload of reasons: permissions,
   client-server communication, etc etc
 * applets: 1 use, setting something gconf-related
 * libgnome: 4 uses, regarding failure to display help or uris
 * glib: only appears in g_error_*

These are the sorts of things exceptions are made for. Furthermore,
exposing GError to the programmer leads to nastiness on the scheme side
of things.

You could implement exceptions by adding 'c-only to the typespec and
extending g-wrap to ignore, from the scheme side, parameters with
'c-only in their typespecs. The scm->c and c->scm ccodegens would still
be run, however, allowing the error to be initialized and checked.

regards,

wingo.


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