[fpc-pascal] Changing iterator usage pattern in FCL-STL

leledumbo leledumbo_cool at yahoo.co.id
Sun Nov 8 19:38:08 CET 2015

FCL-STL from the start has different iterator usage pattern compared to
existing containers (say a TSQLQuery). i.e. the common pattern is:

It := SomeContainer.Iterator;
while not It.EOF do begin

instead, it uses:

It := SomeContainer.Iterator;
until not It.Next;

Examining the iterator code, I can see that the latter has at least the
following disadvantage:
One must add additional guard before executing repeat-until to make sure
that the container has at least 1 data. Otherwise, Next in until expression
will trigger EAccessViolation.

I would like to change the pattern to follow existing one. However, FCL-STL
has been available for some time now that changing the pattern will break
existing code. How do you think I should proceed on this one?

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Changing-iterator-usage-pattern-in-FCL-STL-tp5723038.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.

More information about the fpc-pascal mailing list