[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(no subject)
From: |
Dirk Herrmann |
Subject: |
(no subject) |
Date: |
Fri, 23 Feb 2001 11:19:01 +0100 (MET) |
On Thu, 22 Feb 2001, thi wrote:
> From: Dirk Herrmann <address@hidden>
> Date: Thu, 22 Feb 2001 04:23:54 +0100 (MET)
>
> (define foo (cons 'a 'b))
> (define bar (cons 'c foo))
> (define baz (cons 'd foo))
> (eq? (cdr bar) (cdr baz))
> ==> #t
> [but reading back does not preserve structure]
>
> fyi, below is a semi-recent usenet post that shows one solution.
Actually, no. It shows a solution for the problem that we have already
solved, namely how to store/restore a _single_ structure. However, since
we know how to correctly restore a single struture, a workaround for the
moment can be to put all objects that are to be binary-written into an
array, and then write this array. It may be that this is the only
solution for the problem that makes sense - look at the following example:
(define foo (cons 'a 'b))
(binary-write foo <some-port>)
(set-car! foo 'c)
(binary-write foo <some-port>)
The cell address of foo did not change, but the content did. Thus, to
treat such situations right, we may not keep a hashtable with 'objects
already stored' between different calls to binary-write, because the
objects that were already stored may have been modified in between.
As a conclusion, the solution that is currently implemented is fine.
These issues should, however, be documented.
Best regards,
Dirk Herrmann