roxen.lists.pike.general

Subject Author Date
Re: Iterators and deleting entries from mappings Martin Bähr <mbaehr[at]email[dot]archlab[dot]tuwien[dot]ac> 15-01-2009
On Thu, Jan 15, 2009 at 11:35:05AM +0100, Martin Stjernholm wrote:
> > In Pike 7.8, what is supposed to happen when you use an iterator on
> > a mapping, and then while iterating you delete entries from the mapping?
> If the mapping changes while being iterated, the iterator might miss
> elements, but it should not visit the same element more than once, and
> if an element is present during the whole iteration then it should not
> be missed. (Value changes in elements are irrelevant.)

so if elements are added while the mapping being iterated,
they might be missed, but deleting one element can't cause another
element to be missed. (because obviously it is present for the whole
iteration)

so it is only unclear what happens to new elements.
(would there be any benefit to change that?)

greetings, martin.
-- 
cooperative communication with sTeam      -     caudium, pike, roxen and unix
offering: programming, training and administration   -  anywhere in the world
--
pike programmer   working in china                      community.gotpike.org
unix system-      iaeste.(tuwien.ac|or).at                     open-steam.org
administrator     caudium.org                                    is.schon.org
Martin Bähr       http://www.iaeste.or.at/~mbaehr/