From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: Enable truncation of exception output Date: Fri, 10 Mar 2017 10:07:44 +0100 Message-ID: <87innhbiu7.fsf@gnu.org> References: <38205FE3-791F-4EE8-BD7F-07BC6C0511DE@bluewin.ch> <87r325tt66.fsf@pobox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1489136897 22894 195.159.176.226 (10 Mar 2017 09:08:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 10 Mar 2017 09:08:17 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Mar 10 10:08:13 2017 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cmGWw-0005W5-UO for guile-devel@m.gmane.org; Fri, 10 Mar 2017 10:08:11 +0100 Original-Received: from localhost ([::1]:38075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cmGX2-0007Tg-VY for guile-devel@m.gmane.org; Fri, 10 Mar 2017 04:08:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cmGWo-0007SX-AC for guile-devel@gnu.org; Fri, 10 Mar 2017 04:08:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cmGWl-0006mQ-KL for guile-devel@gnu.org; Fri, 10 Mar 2017 04:08:02 -0500 Original-Received: from [195.159.176.226] (port=53051 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cmGWl-0006lB-C8 for guile-devel@gnu.org; Fri, 10 Mar 2017 04:07:59 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cmGWX-00031I-RG for guile-devel@gnu.org; Fri, 10 Mar 2017 10:07:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 49 Original-X-Complaints-To: usenet@blaine.gmane.org X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 20 =?utf-8?Q?Vent=C3=B4se?= an 225 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Cancel-Lock: sha1:O/DBzSKpMyaAFzVY792UJGVD7x4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:19019 Archived-At: Hello! Andy Wingo skribis: > On Fri 03 Feb 2017 14:40, Daniel Llorens 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’.