[Vala] [LibGee] LinkedList does not increase stamp



Hi,

In the add and insert methods of LinkedList I saw this two line:

// Adding items to the list during iterations is allowed.
//++this._stamp;

Additionally remove_at and/or remove also does not increase the stamp.

But this is the wrong way to do this! Stamp should be increased always
but the iterator should be changed if you want to allow changing of
the list during iteration.


I would go even further and make stamp a read-only property on the
Collection interface. The trick is that with this "outside" Iterators
could be build - for example a SortedIterator for every Collection.
Such a iterator could then do a to_array and sort the list for the
iteration, but such an iterator needs to know if the collection he
used as the origin was changed from the outside or not. If it was it
should make the iterator invalid and not allow the iteration to
proceed (in whatever way). Such an iterator could be extended to allow
such cases but only through the iterator and not from outside.

BTW. It would be nice if LibGee would have its own mailing list as well. :)

regards, Tomaž



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]