GNU bug report logs - #29684
exception printers - request for improvement

Previous Next

Package: guile;

Reported by: David Pirotte <david <at> altosw.be>

Date: Wed, 13 Dec 2017 03:28:02 UTC

Severity: normal

Full log


Message #11 received at 29684 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: David Pirotte <david <at> altosw.be>
Cc: 29684 <at> debbugs.gnu.org
Subject: Re: bug#29684: exception printers - request for improvement
Date: Sun, 01 Jul 2018 18:30:16 +0200
Hi David,

David Pirotte <david <at> 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’.




This bug report was last modified 6 years and 316 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.