[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SRFI 9's default printer doesn't handle cyclic data structures

From: nalaginrut
Subject: Re: SRFI 9's default printer doesn't handle cyclic data structures
Date: Tue, 26 Jul 2011 11:45:27 +0800

> [Crossposted from bug-guile@ since my message isn't posting there. :-(]
> Hi there,
> I've been playing around with Guile's implementation of SRFI 45 (which
> uses SRFI 9), and have noticed something interesting: if you run the
> following code in the REPL, printing out the value of the promise will
> cause a stack overflow:
>     (use-modules (srfi srfi-45))
>     (define promise (delay promise))
>     (force promise)
>     #<promise val: module/ice-9/format.scm:38:0: In procedure format:
>     module/ice-9/format.scm:38:0: Throw to key `vm-error' with args `(vm-run 
> "VM: Stack overflow" ())'.
> However, if I change the SRFI 45 code to use Guile's native records,
> it prints correctly:
>     #<promise val: #<value tag: eager proc: #-1#>>
> For reproducibility, I attached the diff to make SRFI 45 use Guile
> native records.
> So, it seems like SRFI 9's record printer doesn't handle cycles in the
> record data very well. Unfortunately I don't know how to fix this (I
> tried looking at the printer for Guile's native records, but couldn't
> figure out what made it special enough to handle cycles correctly), so
> no fix is attached.
> Many thanks,
> Chris.

Well, I got such a problem too. But some guy told be
set-record-type-printer! is helpful. So I just write a new printer for
my record for testing. I think it's unnecessary to change the module
since the printer is always used in REPL. :)

GNU Powered it
GPL Protected it
GOD Blessed it

HFG - NalaGinrut

--hacker key--
---end key---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]