From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Rottmann Newsgroups: gmane.lisp.guile.devel Subject: Re: R6RS exception printing at the REPL Date: Sat, 27 Nov 2010 01:08:41 +0100 Message-ID: <87ipzj631y.fsf@delenn.lan> References: <87sjzvnu1i.fsf@delenn.lan> <87tyjbkger.fsf@delenn.lan> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1290816944 16986 80.91.229.12 (27 Nov 2010 00:15:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 27 Nov 2010 00:15:44 +0000 (UTC) Cc: Guile Development To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Nov 27 01:15:38 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PM8S1-0005BT-4w for guile-devel@m.gmane.org; Sat, 27 Nov 2010 01:15:37 +0100 Original-Received: from localhost ([127.0.0.1]:52050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PM8S0-00035S-AR for guile-devel@m.gmane.org; Fri, 26 Nov 2010 19:15:36 -0500 Original-Received: from [140.186.70.92] (port=52181 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PM8LT-0007tx-DE for guile-devel@gnu.org; Fri, 26 Nov 2010 19:08:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PM8LS-0005Dx-3Z for guile-devel@gnu.org; Fri, 26 Nov 2010 19:08:51 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:50828 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PM8LR-0005DV-ND for guile-devel@gnu.org; Fri, 26 Nov 2010 19:08:50 -0500 Original-Received: (qmail invoked by alias); 27 Nov 2010 00:08:47 -0000 Original-Received: from 83-215-154-5.hage.dyn.salzburg-online.at (EHLO nathot.lan) [83.215.154.5] by mail.gmx.net (mp007) with SMTP; 27 Nov 2010 01:08:47 +0100 X-Authenticated: #3102804 X-Provags-ID: V01U2FsdGVkX18XqH5BevIXKKrx71/Mtvn9TIrDnEQ92i45C8gNx8 wzgs5ecIQJpjDY Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by nathot.lan (Postfix) with ESMTP id BFEBE3A695; Sat, 27 Nov 2010 01:08:46 +0100 (CET) Original-Received: from nathot.lan ([127.0.0.1]) by localhost (nathot.lan [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id teQHKbl7MNdX; Sat, 27 Nov 2010 01:08:42 +0100 (CET) Original-Received: from delenn.lan (delenn.lan [192.168.3.11]) by nathot.lan (Postfix) with ESMTP id 3138B3A693; Sat, 27 Nov 2010 01:08:42 +0100 (CET) Original-Received: by delenn.lan (Postfix, from userid 1000) id D314A2C0006; Sat, 27 Nov 2010 01:08:41 +0100 (CET) In-Reply-To: (Andy Wingo's message of "Sat, 20 Nov 2010 21:19:18 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11208 Archived-At: Andy Wingo writes: > Heya Andreas, > > On Sat 20 Nov 2010 19:18, Andreas Rottmann writes: > >> Andy Wingo writes: >> >>> set-exception-printer! : exception-printer -> nothing >>> >> Did you mean the following? >> >> set-exception-printer! : key exception-printer -> nothing > > Of course, yes. It seems I distilled the interface down past its > essentials! ;) > :-) >> Did you mean that `print-exception' should go into `(system repl >> error-handling)'? > > This, that print-exception could go into (system repl > error-handling). The reason for this would be to allow the default > exception printer, embedded in print-exception, to use other modules, > like match or pmatch or the like. I think? > That sounds like a good idea. I just sat down to implement this, and noticed that, to not lose current functionality, `print-exception' and exception printer procedures would need a `frame' argument as well, right? >>> What do you think? >>> >> Besides the above questions, I wonder where I should install the >> exception printer for R6RS exceptions (since the code will depend on >> quite a bit of R6RS, so we maybe want to have it loaded on demand, like >> in the last patch. > > Good question. > > For r6rs exceptions, I think either (rnrs conditions) or (rnrs > exceptions). > Ideally I'd like to put it into its own module. The exception printer should be able to freely use all of R6RS, and I'd like to avoid making the already complicated relationships between the modules implementing R6RS even more so by introducing additional imports or `@'-references into either of these modules. I'm aware, however, that the separate-module approach will not work with the proposed exception printer registry unless the module registering the handler is actually loaded; perhaps registering a printer in `(rnrs exceptions)' that lazy-loads the module actually implementing the printer would work, but maybe that would be too hairy? [ It's off-topic in this thread, but I think the circular dependencies introduced by using `@' and `@@' in the R6RS modules should at one point be eliminated; they work almost all the time, but can fail in surprising ways -- see the commit comment of c0f6c163... ] > For srfi-35 conditions, either we make another registry for printers of > srfi-34 [sic] exceptions, or just assume that people using srfi-34 > probably want srfi-35 as well, and have srfi-35 define the printer for > srfi-34 exceptions. > Hmm, that's a kind of a tricky question, since `raise' and the condition system (for both the SRFI and R6RS varieties) are orthogonal, even if they are most often used together. A possible solution might be to allow an exception printer to decline to handle a specific raised object, and fall back on the default behavior. If we do that, it might even make sense to allow multiple printers per throw key. So the API would change just a small bit: exception-printer := port args -> boolean Regards, Rotty -- Andreas Rottmann --