From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: nalaginrut Newsgroups: gmane.lisp.guile.devel Subject: Re: SRFI 9's default printer doesn't handle cyclic data structures Date: Tue, 26 Jul 2011 11:45:27 +0800 Organization: HFG Message-ID: <1311651927.3008.4.camel@Renee-desktop> References: <20110726033359.GA15555@yarrow.destinee.acro.gen.nz> Reply-To: NalaGinrut@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1311651956 7598 80.91.229.12 (26 Jul 2011 03:45:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 26 Jul 2011 03:45:56 +0000 (UTC) Cc: guile-devel@gnu.org To: "Chris K. Jester-Young" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jul 26 05:45:48 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QlYaZ-0005N3-OV for guile-devel@m.gmane.org; Tue, 26 Jul 2011 05:45:47 +0200 Original-Received: from localhost ([::1]:41539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlYaZ-0005X2-Cp for guile-devel@m.gmane.org; Mon, 25 Jul 2011 23:45:47 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:57853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlYaW-0005Wv-Ts for guile-devel@gnu.org; Mon, 25 Jul 2011 23:45:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QlYaV-0004Qt-Ms for guile-devel@gnu.org; Mon, 25 Jul 2011 23:45:44 -0400 Original-Received: from mail-pz0-f49.google.com ([209.85.210.49]:53083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlYaV-0004Qn-GN for guile-devel@gnu.org; Mon, 25 Jul 2011 23:45:43 -0400 Original-Received: by pzk33 with SMTP id 33so83122pzk.8 for ; Mon, 25 Jul 2011 20:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:reply-to:to:cc:in-reply-to:references:content-type :organization:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=Olxivw0Tep69t6l20gGCKGSVTP38jnZrcQ/Y4XNRNFg=; b=xMK15DWU1CuIqHmcEbjUGcsI78GovZOgSGvb1UheHCahoyFG165W8+oIMk17S2rH8F 2UvQH25u9PxsWxl4arJ61s1dgT1PuL6vMa63yhPvvgZzDxvo8Z9N2DU5r8CEECCjDar/ QhcZp6AZc/eh8cbjvwlL81v/O9F8IlP1cagwU= Original-Received: by 10.68.55.131 with SMTP id s3mr1140837pbp.294.1311651942126; Mon, 25 Jul 2011 20:45:42 -0700 (PDT) Original-Received: from [192.168.100.100] ([183.37.232.93]) by mx.google.com with ESMTPS id z6sm82942pbc.62.2011.07.25.20.45.34 (version=SSLv3 cipher=OTHER); Mon, 25 Jul 2011 20:45:40 -0700 (PDT) In-Reply-To: <20110726033359.GA15555@yarrow.destinee.acro.gen.nz> X-Mailer: Evolution 2.28.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.49 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12683 Archived-At: > [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) > > # 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: > > #> > > 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-- v4sw7CUSMhw6ln6pr8OSFck4ma9u8MLSOFw3WDXGm7g/l8Li6e7t4TNGSb8AGORTDLMen6g6RASZOGCHPa28s1MIr4p-x hackerkey.com ---end key---