* bug#29669: repl-print - requet for iprovement
@ 2017-12-11 23:36 David Pirotte
2018-07-01 16:26 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: David Pirotte @ 2017-12-11 23:36 UTC (permalink / raw)
To: 29669
[-- Attachment #1.1: Type: text/plain, Size: 287 bytes --]
Hello,
Attached a patch so repl-print becomes 'friendly' wrt large (huge) lists,
arrays, srfi-4 bytevectors ...
I looked at the documentation but I could not spot anything/places where
things would need to be changed wrt the above patch?
Dito wrt tests?
Thanks,
David
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Updating-repl-print-to-use-truncated-print.patch --]
[-- Type: text/x-patch, Size: 1780 bytes --]
From d920d22efe3e77d23004122e21cec420c402f531 Mon Sep 17 00:00:00 2001
From: David Pirotte <david@altosw.be>
Date: Mon, 11 Dec 2017 21:28:24 -0200
Subject: [PATCH] Updating repl-print to use truncated-print
* module/system/repl/common.scm (repl-print): Use (truncated-print val),
not (write val). With this update, repl-print becomes 'friendly' wrt
large (huge) lists, arrays, srfi-4 butevoectors ...
---
module/system/repl/common.scm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/module/system/repl/common.scm b/module/system/repl/common.scm
index 42d5c24ae..47799957d 100644
--- a/module/system/repl/common.scm
+++ b/module/system/repl/common.scm
@@ -1,6 +1,6 @@
;;; Repl common routines
-;; Copyright (C) 2001, 2008-2016 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2008-2017 Free Software Foundation, Inc.
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public
@@ -28,6 +28,7 @@
#:autoload (language tree-il optimize) (optimize)
#:use-module (ice-9 control)
#:use-module (ice-9 history)
+ #:use-module (ice-9 pretty-print)
#:export (<repl> make-repl repl-language repl-options
repl-tm-stats repl-gc-stats repl-debug
repl-welcome repl-prompt
@@ -223,7 +224,7 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
;; should be printed with the generic printer, `write'. The
;; language-printer is something else: it prints expressions of
;; a given language, not the result of evaluation.
- (write val)
+ (truncated-print val)
(newline))))))
(define (repl-option-ref repl key)
--
2.15.1
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#29669: repl-print - requet for iprovement
2017-12-11 23:36 bug#29669: repl-print - requet for iprovement David Pirotte
@ 2018-07-01 16:26 ` Ludovic Courtès
2018-07-05 7:49 ` Andy Wingo
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2018-07-01 16:26 UTC (permalink / raw)
To: David Pirotte; +Cc: Andy Wingo, 29669
Hello,
David Pirotte <david@altosw.be> skribis:
> From d920d22efe3e77d23004122e21cec420c402f531 Mon Sep 17 00:00:00 2001
> From: David Pirotte <david@altosw.be>
> Date: Mon, 11 Dec 2017 21:28:24 -0200
> Subject: [PATCH] Updating repl-print to use truncated-print
>
> * module/system/repl/common.scm (repl-print): Use (truncated-print val),
> not (write val). With this update, repl-print becomes 'friendly' wrt
> large (huge) lists, arrays, srfi-4 butevoectors ...
Note that it’s already possible to do this:
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use (ice-9 pretty-print)
scheme@(guile-user)> ,o print (lambda (repl obj) (truncated-print obj) (newline))
scheme@(guile-user)> (iota 500)
$20 = (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 # …)
--8<---------------cut here---------------end--------------->8---
So the question becomes: should we change the default?
I have a slight preference for keeping the default as it is to avoid
surprises, but no strong opinion.
Andy, Mark, others, WDYT?
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#29669: repl-print - requet for iprovement
2018-07-01 16:26 ` Ludovic Courtès
@ 2018-07-05 7:49 ` Andy Wingo
2018-08-04 2:37 ` David Pirotte
0 siblings, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2018-07-05 7:49 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 29669
On Sun 01 Jul 2018 18:26, ludo@gnu.org (Ludovic Courtès) writes:
> Hello,
>
> David Pirotte <david@altosw.be> skribis:
>
>> From d920d22efe3e77d23004122e21cec420c402f531 Mon Sep 17 00:00:00 2001
>> From: David Pirotte <david@altosw.be>
>> Date: Mon, 11 Dec 2017 21:28:24 -0200
>> Subject: [PATCH] Updating repl-print to use truncated-print
>>
>> * module/system/repl/common.scm (repl-print): Use (truncated-print val),
>> not (write val). With this update, repl-print becomes 'friendly' wrt
>> large (huge) lists, arrays, srfi-4 butevoectors ...
>
> Note that it’s already possible to do this:
>
> scheme@(guile-user)> ,use (ice-9 pretty-print)
> scheme@(guile-user)> ,o print (lambda (repl obj) (truncated-print obj) (newline))
> scheme@(guile-user)> (iota 500)
> $20 = (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 # …)
>
> So the question becomes: should we change the default?
>
> I have a slight preference for keeping the default as it is to avoid
> surprises, but no strong opinion.
>
> Andy, Mark, others, WDYT?
Hoo, I don't know. If we were to do this it should be controllable by
REPL options, I think; we'd need the ability to go back and forth. But
if we have the option I think it could make sense for it to be on by
default, like what GDB does. Thing is, truncated-print does its job
only OK, not great, so it's a hard sell to standardize on it. You
probably do want multi-line prints sometimes...
Andy
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#29669: repl-print - requet for iprovement
2018-07-05 7:49 ` Andy Wingo
@ 2018-08-04 2:37 ` David Pirotte
0 siblings, 0 replies; 4+ messages in thread
From: David Pirotte @ 2018-08-04 2:37 UTC (permalink / raw)
To: Andy Wingo; +Cc: Ludovic Courtès, 29669
[-- Attachment #1: Type: text/plain, Size: 1974 bytes --]
Hi Ludo,
Andy,
> > scheme@(guile-user)> ,use (ice-9 pretty-print)
> > scheme@(guile-user)> ,o print (lambda (repl obj) (truncated-print obj) (newline))
> > scheme@(guile-user)> (iota 500)
> > $20 = (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
> > # …)
> >
> > So the question becomes: should we change the default?
Why not? then who would want multi-line prints would do the 'oppoite' of the above,
right?
scheme@(guile-user)> ,use (ice-9 pretty-print)
scheme@(guile-user)> ,o print (lambda (repl obj) (write obj) (newline))
Or, as I do in Guile-CV, implement a specific display method for 'their
objects' (im-display in guile-cv, and the manual says 'to be used with caution...)
> > I have a slight preference for keeping the default as it is to avoid
> > surprises, but no strong opinion.
What surprise(s)? :),
I mean, what sort of code or who's the one of us who would rely on the repl print
'layout' in any sort of way(s)?
> > Andy, Mark, others, WDYT?
> Hoo, I don't know. If we were to do this it should be controllable by
> REPL options, I think; we'd need the ability to go back and forth. But
> if we have the option I think it could make sense for it to be on by
> default, like what GDB does.
It seems to me it is a yes :)
note that (just not to forgot), we need this to be done both for the repl
_and_ exception printers as well ... it is as essential if not more then
within the repl
> Thing is, truncated-print does its job only OK, not great, so it's a hard sell to
> standardize on it. You probably do want multi-line prints sometimes...
I'm actually using truncated-print all the time, since it is simply impossible
otherwise to use/develop guile-v, and I never spotted any 'problem' (not to say I
can guarantee there is none of course, but that did not happen in years). Then we
could always improve when someone report a problem ...
Thanks,
David
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-04 2:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-11 23:36 bug#29669: repl-print - requet for iprovement David Pirotte
2018-07-01 16:26 ` Ludovic Courtès
2018-07-05 7:49 ` Andy Wingo
2018-08-04 2:37 ` David Pirotte
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).