[fpc-devel] New feature discussion: for-in loop

Alexander Klenin klenin at gmail.com
Sun Oct 25 11:48:16 CET 2009


On Sun, Oct 25, 2009 at 20:05, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
> On 25/10/2009, Alexander Klenin <klenin at gmail.com> wrote:
>>
>> IMHO, Reset/JumpToBack should not be used inside "for..in" loop -- they are
>>  analogous to "goto" inside for loop.
>>  If "for .. in .. index" extension is implemented, it may be used to call
>
>
> As I explained in my previous reply to Paul - I did not expect for-in
> to support everything I use with Iterators. I simply wanted to find
> out if the for-in implementation is going to clash with my idea of
> implementing GetIterator() in RTL's container classes. So far I don't
> see any problems, and I can't see why we can't implement both. There
> are use-cases for both.  I see for-in as a "lite" version of Iterator,
> but I still have a need for a more "full" implementation as well -
> supporting a larger method interface.

AFAIU, the whole point of the previous discussion is
that you do not have to implement "GetIterator" separately
from "GetEnumerator" -- you can have the same class filling both roles.

-- 
Alexander S. Klenin



More information about the fpc-devel mailing list