Browse thread
Trouble with doubly-linked, circular list using lazy evaluation
-
Denis Bueno
- Damien Doligez
- Richard Jones
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-11-17 (15:01) |
From: | Damien Doligez <damien.doligez@i...> |
Subject: | Re: [Caml-list] Trouble with doubly-linked, circular list using lazy evaluation |
On 2006-10-25, at 03:46, Denis Bueno wrote: > I get a "Bus error" when running a unit test on a doubly-linked > circular list (of length 2). A self-contained test case is included > [1]. I have 8 fields in a record which includes two left & right > pointers (not ref types). > > I am running a PowerMac G5 2.5GHz (uname -a: Darwin ford.local 8.8.0 > Darwin Kernel Version 8.8.0: Fri Sep 8 17:18:57 PDT 2006; > root:xnu-792.12.6.obj~1/RELEASE_PPC Power Macintosh powerpc) and > ocaml 3.09.3. > > Interestingly, if I remove a field (such as the mark field), the test > case succeeds. That was an interesting bug. Thanks for reporting it. It has nothing to do with lazy values: it's an interference between "let rec" of values and an optimization in the implementation of the { ... with ... } construct. To work around the bug, you can remove all instances of let rec ... = { ... with ... } (i.e. the "with" construct as the toplevel expression of a letrec-bound variable) by expanding the "with" construct by hand. I am fixing it in the 3.09 branch (3.09.4+dev1). -- Damien