English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Hashtbl.iter
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-10-17 (08:31)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] Hashtbl.iter
From: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
> Wed, 17 Oct 2001 15:28:54 +0900, Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp> pisze:
> > If you look at the source in hashtbl.ml, clearly the answer is
> > "undefined behaviour". If your new element is added in a bucket
> > after the one your are currently processing then yes, otherwise no,
> And if the table is resized because of the added element, you are
> completely screwed. This undefined behavior is not limited to the
> choice between processing the new element or not.

No, no. It is not that bad. This just means that a new array will be
built, replacing the one you are currently processing. As a result
further changes on the hashtable will have absolutely no impact on the
behaviour of Hashtbl.iter.

That said, it is not a good idea to modify a mutable data structure
while you are processing it. There are immutable ones for that.

Jacques Garrigue
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr