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

Sergei Gorelkin sergei_gorelkin at mail.ru
Wed Oct 21 03:22:44 CEST 2009


Paul Ishenin wrote:
> Sergei Gorelkin wrote:
> 
>> Probably yes. A possibility to use any type which has certain 
>> methods/operators instead looks attractive, but I'm afraid it would be 
>> hard to fit that into existing compiler model.
> 
> Sorry, what is TIterator? Is this like to the previosly suggested
> 
> TIterator = interator(<Type>, MoveNext, Current)
> end;

I did not try to specify what exactly TIterator is. What I tried to say 
is: "some type that is already known at the point of parsing the for..in".
> 
> Btw, we can use some new 'enumerator'/'iterator' directive to mark 
> methods which return enumerators.
> 
> And only in delphi mode we will search for the GetEnumerator method.
> 
The question is, what advantage all this specific syntax could give over 
simple searching the methods by name?


Sergei



More information about the fpc-devel mailing list