From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21297 invoked by alias); 2 Jun 2003 09:20:17 -0000 Mailing-List: contact guile-gtk-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: guile-gtk-owner@sources.redhat.com Received: (qmail 21067 invoked from network); 2 Jun 2003 09:20:13 -0000 Received: from unknown (HELO octopussy.utanet.at) (213.90.36.45) by sources.redhat.com with SMTP; 2 Jun 2003 09:20:13 -0000 Received: from pam.utanet.at ([213.90.36.6]) by octopussy.utanet.at with esmtp (Exim 4.12) id 19MlUD-0006BO-00 for guile-gtk@sources.redhat.com; Mon, 02 Jun 2003 11:20:13 +0200 Received: from dsl-155-232.utaonline.at ([62.218.155.232] helo=rotty-ipv4.yi.org) by pam.utanet.at with esmtp (Exim 4.12) id 19MlUC-0008Sj-00 for guile-gtk@sources.redhat.com; Mon, 02 Jun 2003 11:20:12 +0200 Received: from alice.rhinosaur.lan ([192.168.1.3] ident=mail) by rotty-ipv4.yi.org with esmtp (Exim 3.36 #1 (Debian)) id 19MlUN-00010S-00 for ; Mon, 02 Jun 2003 11:20:23 +0200 Received: from andy by alice.rhinosaur.lan with local (Exim 4.20) id 19MlUN-0001EE-5L for guile-gtk@sources.redhat.com; Mon, 02 Jun 2003 11:20:23 +0200 To: guile-gtk@sources.redhat.com Subject: Re: GError References: <20030524113300.GB24132@lark> <87addamxbz.fsf@zip.com.au> <20030526172355.GA6014@lark> From: Andreas Rottmann Date: Mon, 02 Jun 2003 09:20:00 -0000 In-Reply-To: <20030526172355.GA6014@lark> (Andy Wingo's message of "Mon, 26 May 2003 18:23:55 +0100") Message-ID: <8765novns8.fsf@alice.rotty.yi.org> User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-q2/txt/msg00127.txt.bz2 Andy Wingo writes: > Hi Kevin, > > On Mon, 26 May 2003, Kevin Ryde wrote: > >> Andy Wingo 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_* ^^^^^^^ Not really true; there are quite a bunch of uses in glib: ~% grep GError /usr/include/glib-2.0/glib/*.h | wc -l 68 > 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. > I agree that throwing exceptions instead of using GError is probably the way to go; especially if you take this into account (from the GLib manual): ,---- | GLib provides a standard method of reporting errors from a called | function to the calling code. (This is the same problem solved by | exceptions in other languages.) `---- Regards, Andy -- Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62 It's GNU/Linux dammit!