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

"Vinzent Höfler" JeLlyFish.software at gmx.net
Tue Oct 20 11:37:03 CEST 2009


Graeme Geldenhuys <graemeg.lists at gmail.com>:

> Well, with for-in you can only loop through a list is a specific order
> and direction. You can't peak forward, you can't move back, you can't
> filter returned content.

At least you know it will terminate. That always was a guaranteed property of the for-loop. With being able to move back and forth as some iterator wishes, this property will be gone forever.

Iterators:                Good idea.
Using for-loops for that: Bad idea.

for-loops are for "static" things, be it enumerations, sets, or ranges. I would vote for that, but not for (disguised) iterators in for-loops. Those are more suited for while-loops.


Vinzent.
-- 
Neu: GMX DSL bis 50.000 kBit/s und 200,- Euro Startguthaben!
http://portal.gmx.net/de/go/dsl02



More information about the fpc-devel mailing list