caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: qrczak@knm.org.pl
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Hashtbl.iter
Date: Wed, 17 Oct 2001 17:30:45 +0900	[thread overview]
Message-ID: <20011017173045X.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <slrn9sqail.1m2.qrczak@qrnik.zagroda>

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


  reply	other threads:[~2001-10-17  8:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-17  6:17 Maya Ramanath
2001-10-17  6:28 ` Jacques Garrigue
     [not found] ` <9qj955$1l5$1@qrnik.zagroda>
2001-10-17  6:51   ` Marcin 'Qrczak' Kowalczyk
2001-10-17  8:30     ` Jacques Garrigue [this message]
2001-10-17  8:49 ` Fabrice Le Fessant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011017173045X.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=qrczak@knm.org.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).