unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: David Pirotte <david@altosw.be>
Cc: 29684@debbugs.gnu.org
Subject: bug#29684: exception printers - request for improvement
Date: Sun, 01 Jul 2018 18:30:16 +0200	[thread overview]
Message-ID: <87in5yrk9z.fsf@gnu.org> (raw)
In-Reply-To: <20171213012435.34d43175@capac> (David Pirotte's message of "Wed,  13 Dec 2017 01:26:33 -0200")

Hi David,

David Pirotte <david@altosw.be> skribis:

> +;; instead of using the above, let's define a specific format binding
> +;; for exception printers, to allow its user customization.
> +(define exception-format simple-format)
> +
>  ;; this is scheme wrapping the C code so the final pred call is a tail call,
>  ;; per SRFI-13 spec
>  (define string-any
> @@ -762,7 +766,7 @@ information is unavailable."
>                         ((not (car args)) 1)
>                         (else 0))))
>       (else
> -      (format (current-error-port) "guile: uncaught throw to ~a: ~a\n"
> +      (exception-format (current-error-port) "guile: uncaught throw to ~a: ~a\n"

It seems to me that you can achieve similar effect, at least in some
cases, by parameterizing ‘current-error-port’.  It also makes more sense
to me to parameterize ‘current-error-port’ rather than set
‘exception-format’, because the ‘exception-format’ is very constrained:
it has to implement at least everything ‘simple-format’ implements.

WDYT?

Besides, note that there’s also ‘set-exception-printer!’.  It’s a
different kind of customization, but it can serve a similar purpose.

Thanks,
Ludo’.





  reply	other threads:[~2018-07-01 16:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-13  3:26 bug#29684: exception printers - request for improvement David Pirotte
2018-07-01 16:30 ` Ludovic Courtès [this message]
2018-07-01 22:23   ` David Pirotte
2018-07-02  6:49     ` Ludovic Courtès
2018-07-03 19:31       ` David Pirotte
2018-07-04  9:30         ` tomas
2018-08-04  2:17           ` David Pirotte
     [not found] <mailman.20.1513184404.6520.bug-guile@gnu.org>
2017-12-14 14:38 ` Daniel Llorens

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=87in5yrk9z.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=29684@debbugs.gnu.org \
    --cc=david@altosw.be \
    /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).