This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Questions about SRFI-38
- From: Charles Turner <chturne at gmail dot com>
- To: kawa at sourceware dot org
- Date: Mon, 02 May 2011 01:41:31 +0100
- Subject: Questions about SRFI-38
My strategy so far has been to extend DisplayFormat with a formatter
that looks for shared structures (SSDisplayFormat). Instead of changing
Scheme's write directly, I thought seperating the concerns would be
wise. The kawa.lib.ports write can always be changed to write/ss later,
if a permanent change is wanted.
I'm just overriding writeList for now (testing). I have another class,
SharedStructure, which takes a list (for the time being) in its
constructor. I'm using a HashMap--which might have to be changed for
sync reasons--to keep track of the elements in the list. The first value
into the hash is the current list, i.e. the reference to current list
before traversing in. I need to map some sort of reference to this list
to some other entity which I won't go into right now. This is where I'm
getting stuck.
If I try and stuff a self-referential list into the hash, I just get a
stack overflow error because Java is too eager it seems (better than the
current behaviour though, at least it stops fairly quickly :-)). I can't
acquire the hash code of the starting list for the same reason. My use
case is a dotted pair whose car points to itself. Please may someone
advise me on how to approach this? Sorry that I haven't made more of a
dent in the problem.
Thanks for your time,
Charles.