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] 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" <>
> Wed, 17 Oct 2001 15:28:54 +0900, Jacques Garrigue <> pisze:
> > If you look at the source in, 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:  FAQ:
To unsubscribe, mail  Archives: