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

Micha Nelissen micha at neli.hopto.org
Wed Oct 21 15:35:01 CEST 2009


Michael Van Canneyt wrote:
> I see little gain in changing
> 
>   while Something(f) do
>     F.Somethingelse

This is not quite equal, it's more like:

Start(f);
while not Last(f) do
   F.DoWork;

In your case, the function 'Something' must know about a generic F.

There are also recursive state problems to be thought about. I guess 
this is why in the STL an iterator is a separate object on the local 
stack, but able to iterate through (another) object of the defined type.

Micha



More information about the fpc-devel mailing list