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

Michael Van Canneyt michael at freepascal.org
Wed Oct 21 14:15:13 CEST 2009



On Wed, 21 Oct 2009, Micha Nelissen wrote:

> Michael Van Canneyt wrote:
>> On Wed, 21 Oct 2009, Micha Nelissen wrote:
>>> So the place in this list determines its function?
>> 
>> Yes. Just like in an operator...
>
> Hmm that's not comparable, for operators it's much more intuitive what to 
> expect as the context is forced, Result := <expr> <op> <expr>;

A loop also has a 'forced' context of 3 expressions:

for i:=expr1 to expr2 do
   begin
   // Implicit I:=I+1;
   end;

C makes this even more explicit.

This is all just nitpicking. Iterators as a language construct are a very ugly
hack to save some typing, no matter how you turn it. Nice maybe for
languages with dynamic typing and so on, but really not on it's place in Pascal.

Michael.



More information about the fpc-devel mailing list