unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#59540: Calling length on a very long improper list is disastrous.
@ 2022-11-24 10:52 Jeremy Phelps
  2022-12-10 17:27 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Phelps @ 2022-11-24 10:52 UTC (permalink / raw)
  To: 59540

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

I lost my Emacs session today because I accidentally called the length
function on an extremely long improper list.

But Guile prints the entire thing when it reports the error that happens
when the length function gets to the improper part of the list. It tried to
print a few million elements just to tell me which list wasn't a proper
list.

To reproduce the error should be easy:

(length

   (let loop ((result 'x)

              (n 50000000))

     (if (= n 0)

         result

         (loop (cons n result) (- n 1)))))


Emacs is more sensitive to the problem because it doesn't throw away any of
the output. It's also really bad over SSH. The above test is enough to dump
output to a local terminal for a minute or two, or to uninterruptibly tie
up an SSH session for several minutes.

[-- Attachment #2: Type: text/html, Size: 1687 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-12 11:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 10:52 bug#59540: Calling length on a very long improper list is disastrous Jeremy Phelps
2022-12-10 17:27 ` Ludovic Courtès
2022-12-12  9:25   ` lloda
2022-12-12 11:45     ` Ludovic Courtès

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).