Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Bug in Hashtbl ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-03-21 (16:02)
From: Vesa Karvonen <vesa.karvonen@h...>
Subject: Re: [Caml-list] Bug in Hashtbl ?
Thanks to everyone for the quick replies.

From: "Alain Frisch" <>
> On Thu, 21 Mar 2002, Vesa Karvonen wrote:
> >
> > The following program raises an Out_of_memory exception. Is this:
> > - correct behavior,
> > - bug in Ocaml 3.04, or
> > - bug somewhere else?
> I would say "correct behavior"; the manual says, about generic
> comparisons:
>      Comparison between cyclic structures may not terminate.

Yep, this seems to be the problem.

It might be wise to specifically mention in the Hashtbl documentation that the
functorial version is needed for cyclic structures. The Hashtbl.hash function
documentation easily gices the wrong impression.

> Note that it would be costly to implement exact (structural) comparison of
> cyclic structures (with a coinductive definition). What you want is
> probably to test for physical equality; you can use the functorial version
> of hash tables to do that.

The code is actually a stripped down version of a unit test, so it is not a
problem to change to an acyclic representation. The application isn't using
cyclic structures.

  Vesa Karvonen

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: