From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: Re: Enable truncation of exception output
Date: Fri, 10 Mar 2017 10:07:44 +0100 [thread overview]
Message-ID: <87innhbiu7.fsf@gnu.org> (raw)
In-Reply-To: 87r325tt66.fsf@pobox.com
Hello!
Andy Wingo <wingo@pobox.com> skribis:
> On Fri 03 Feb 2017 14:40, Daniel Llorens <daniel.llorens@bluewin.ch> writes:
>
>> The patch to master (ice-9 boot-9) lets you override the (format) used
>> internally by the exception printers. Then I rewrite the format string
>> in user code, see below. It's a bit hacky, maybe someone has a better
>> solution.
>>
>> See also the other patch I've posted to the list to support arrays in
>> (truncated-print). The patches are independent, but they make each
>> other useful so to speak.
>
> I have a crazy idea :) What about, we just let (ice-9 format) be
> "format" ? Right now loading (ice-9 format) does a set! to format, as
> you know, overriding the core binding. This is unnecessary and
> complicated. I see that using (ice-9 format) only adds 50 KB to the
> 2828-KB baseline of private dirty memory. Then we can use :@y
> directly in the format strings and we can avoid all the monkeypatching.
>
> There are only a couple instances of calls to scm_simple_format in
> libguile and they can be replaced, so we don't have C bootstrapping
> concerns. Guile users calling scm_simple_format would do a pthread_once
> load to the "format" binding in the root module. In boot-9, we start
> with a simple boot definition (for boot-time errors) then replace it
> with (module-ref (resolve-interface '(ice-9 format) 'format)) at the
> end.
>
> Maybe Ludovic has a thought here :)
I’d be in favor of something more conservative, notably because
‘simple-format’ remains faster than ‘format’:
1. Remove ‘set!’ in (ice-9 format), which has always been a bad idea.
-Wformat behaves as if this ‘set!’ wasn’t in place (that is, it
warns you if you’re using “extended” functionality but haven’t
explicitly imported (ice-9 format)), so I suspect little code will
break.
Then (ice-9 format) can #:replace (format) instead of #:export.
2. For exception printers, use some autoload magic, just like we do
for the debugger.
How does that sound? I believe this should work no?
Ludo’.
next prev parent reply other threads:[~2017-03-10 9:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 13:40 Enable truncation of exception output Daniel Llorens
2017-03-10 8:47 ` Andy Wingo
2017-03-10 9:07 ` Ludovic Courtès [this message]
2017-03-10 9:17 ` Andy Wingo
2017-03-10 9:12 ` 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=87innhbiu7.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guile-devel@gnu.org \
/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).