in reply to Re: Design thoughts: iterator invalidation
in thread Design thoughts: iterator invalidation

Personally, I don't think I'd trust the iterator after changing the hash, but I'd probably hope that it would iterate until there are zero keys in the hash that it has not yet returned.

There are two problems with that statement:

  1. How would you know that the hash had changed if the change(s) occur in (a) different thread(s).
  2. Remembering which keys have already been returned would impose a huge burden.

    Ditto: noticing that a new key had been added at a point preceding the current position of the iterator.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
  • Comment on Re^2: Design thoughts: iterator invalidation

Replies are listed 'Best First'.
Re^3: Design thoughts: iterator invalidation
by SuicideJunkie (Vicar) on Feb 24, 2015 at 17:49 UTC

    I do agree that it would probably be terrible to actually implement, moreso with threads involved. It would just be convenient if it magically worked that way.