Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Vesa Karvonen <vesa.karvonen@h...>
Subject: Re: [Caml-list] Bug in Hashtbl ?
Thanks to everyone for the quick replies.

From: "Alain Frisch" <frisch@clipper.ens.fr>
> 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.

Regards,
  Vesa Karvonen


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners