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: R6RS exception printing -- take #2 Date: Tue, 01 Feb 2011 01:19:22 +0100 Message-ID: <87y660txmd.fsf@rotty.yi.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1296519677 26794 80.91.229.12 (1 Feb 2011 00:21:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 1 Feb 2011 00:21:17 +0000 (UTC) To: Guile Development Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Feb 01 01:21:13 2011 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 1Pk3zc-0007oZ-7n for guile-devel@m.gmane.org; Tue, 01 Feb 2011 01:21:13 +0100 Original-Received: from localhost ([127.0.0.1]:54193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pk3zW-0008Ee-Pf for guile-devel@m.gmane.org; Mon, 31 Jan 2011 19:21:06 -0500 Original-Received: from [140.186.70.92] (port=58472 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pk3zE-0008AT-SJ for guile-devel@gnu.org; Mon, 31 Jan 2011 19:21:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pk3xy-0008EV-Ui for guile-devel@gnu.org; Mon, 31 Jan 2011 19:19:32 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:53357) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Pk3xy-0008Dm-9u for guile-devel@gnu.org; Mon, 31 Jan 2011 19:19:30 -0500 Original-Received: (qmail invoked by alias); 01 Feb 2011 00:19:27 -0000 Original-Received: from 83-215-154-5.hage.dyn.salzburg-online.at (EHLO nathot.lan) [83.215.154.5] by mail.gmx.net (mp011) with SMTP; 01 Feb 2011 01:19:27 +0100 X-Authenticated: #3102804 X-Provags-ID: V01U2FsdGVkX18oqR5d+tUo/aumPx4znxX/5wELEyeZ6T0UFdqiUT dlpqapbmFHvwYE Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by nathot.lan (Postfix) with ESMTP id CF7553A6B8 for ; Tue, 1 Feb 2011 01:19:26 +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 YYs1RX2Pys2i for ; Tue, 1 Feb 2011 01:19:22 +0100 (CET) Original-Received: from delenn.lan (delenn.lan [192.168.3.11]) by nathot.lan (Postfix) with ESMTP id D5A393A6A5 for ; Tue, 1 Feb 2011 01:19:22 +0100 (CET) Original-Received: by delenn.lan (Postfix, from userid 1000) id 88BEC2C0083; Tue, 1 Feb 2011 01:19:22 +0100 (CET) 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-Received-From: 213.165.64.23 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:11479 Archived-At: Hi! I've started refreshing the patch[0] to improve exception presentation for R6RS exceptions, initially discussed in [1]. I'd like to solicit clarification on a few points. To recap, it was agreed to add something like the following internal API to boot-9.scm: exception-printer := port key args exception-printer -> nothing set-exception-printer! : key exception-printer -> nothing exception-printer : key -> exception-printer OR #f In the above, exception-printer is a procedure that's supposed to either display the exception it got passed (via `args') on `port', or "punt", by calling the exception printer passed to it. Note that, relative to the previous discussion, I've added the argument `key', to make it possible for the fallback (generic) exception printer, as passed to any registered exception printer as its last argument, to display the key of the raised exception. Another option (which I slightly prefer) would be this change, relative to the above API: exception-printer := port args thunk In this variant, the exception printer may call `thunk' to punt on handling the exception -- the `key' argument is not necessary anymore, as it can be closed over by the thunk. This exception registry would be used in the REPL error-handling code primarily, via a `print-exception' procedure querying the registry and invoking the matching printer (or the default one, if no printer is matching). Another open issue is the potential `frame' argument; it seems this is only used at one place in `(system repl error-handling)', inside `call-with-error-handling' (I did a quick grep for "display-error" and "Throw to" to identify the sites where I'd plug in the exception registry via the `print-exception' procedure). If we decide that `frame' should not be part of the exception-printer arguments, we'd lose source information in the exception printout in this case. As `call-with-error-handling' is only used in the REPL (where one could get source information via the ",bt" meta-command) and in `(web server)', I guess the loss would be bearable. [ Just a thought: it looks like it /might/ make sense to contemplate deprecating passing the frame information to `display-error' and untangle displaying the exception object and displaying a backtrace completely. ] Regards, Rotty -- Andreas Rottmann --