unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andreas Rottmann <a.rottmann@gmx.at>
To: Andy Wingo <wingo@pobox.com>
Cc: Guile Development <guile-devel@gnu.org>
Subject: Re: R6RS exception printing at the REPL
Date: Sat, 27 Nov 2010 01:08:41 +0100	[thread overview]
Message-ID: <87ipzj631y.fsf@delenn.lan> (raw)
In-Reply-To: <m34obb21fd.fsf@unquote.localdomain> (Andy Wingo's message of "Sat, 20 Nov 2010 21:19:18 +0100")

Andy Wingo <wingo@pobox.com> writes:

> Heya Andreas,
>
> On Sat 20 Nov 2010 19:18, Andreas Rottmann <a.rottmann@gmx.at> writes:
>
>> Andy Wingo <wingo@pobox.com> 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 -- <http://rotty.yi.org/>



  reply	other threads:[~2010-11-27  0:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-24 21:46 R6RS exception printing at the REPL Andreas Rottmann
2010-11-20 15:23 ` Andy Wingo
2010-11-20 18:18   ` Andreas Rottmann
2010-11-20 20:19     ` Andy Wingo
2010-11-27  0:08       ` Andreas Rottmann [this message]
2010-11-29 20:15         ` @ and @@ in r6rs libs [Was: R6RS exception printing at the REPL] Andy Wingo
2010-11-29 22:35           ` Andreas Rottmann
2010-11-29 20:34         ` R6RS exception printing at the REPL Andy Wingo
2010-11-29 23:20           ` Andreas Rottmann
2010-12-01 23:16             ` Ludovic Courtès
2010-12-01 23:13           ` Ludovic Courtès
2010-12-02 20:21             ` Andreas Rottmann
2010-12-13 16:49               ` Ludovic Courtès

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=87ipzj631y.fsf@delenn.lan \
    --to=a.rottmann@gmx.at \
    --cc=guile-devel@gnu.org \
    --cc=wingo@pobox.com \
    /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).