<p>Am 08.11.2015 22:36 schrieb "Michael Van Canneyt" <<a href="mailto:michael@freepascal.org">michael@freepascal.org</a>>:<br>
><br>
><br>
><br>
> On Sun, 8 Nov 2015, Sven Barth wrote:<br>
><br>
>> On 08.11.2015 19:38, leledumbo wrote:<br>
>>><br>
>>> FCL-STL from the start has different iterator usage pattern compared to<br>
>>> existing containers (say a TSQLQuery). i.e. the common pattern is:<br>
>>><br>
>>> It := SomeContainer.Iterator;<br>
>>> while not It.EOF do begin<br>
>>> ...<br>
>>> It.Next;<br>
>>> end;<br>
>>><br>
>>> instead, it uses:<br>
>>><br>
>>> It := SomeContainer.Iterator;<br>
>>> repeat<br>
>>> ...<br>
>>> until not It.Next;<br>
>>><br>
>>> Examining the iterator code, I can see that the latter has at least the<br>
>>> following disadvantage:<br>
>>> One must add additional guard before executing repeat-until to make sure<br>
>>> that the container has at least 1 data. Otherwise, Next in until expression<br>
>>> will trigger EAccessViolation.<br>
>>><br>
>>> I would like to change the pattern to follow existing one. However, FCL-STL<br>
>>> has been available for some time now that changing the pattern will break<br>
>>> existing code. How do you think I should proceed on this one?<br>
>><br>
>><br>
>> I'd say don't change. In my opinion the need to restructure one's code outweighs that disadvantage. If anything then add a for-in compatible iterator like was done for TVector<>.<br>
><br>
><br>
> Enumerator, you mean ?</p>
<p>Yes. For most standard cases these should be enough.</p>
<p>Regards,<br>
Sven</p>