[fpc-pascal] Forin Test

Dariusz Mazur darekm at emadar.com
Sat Nov 7 13:29:17 CET 2009

Paul Ishenin pisze:
> darekm wrote:
>> I've play with forin construction. To my work I need more than one 
>> per collection.
>> In attach is one of example program.
>> Can someone review it. is this proper construction.
> operator enumerator (AEnumerator: TEnumerator): TEnumerator;
> begin
>  Result := AEnumerator
> end;
> It is a bit hackish but I see problems with it.
Its work now with current compilator. Are You plan to disable this?

>  for i in List.up do
>    WriteLn(i);
> will be possible to transform into
>  for i in List using Up do
>    WriteLn(i);
> or
>  for i in List using GetEnumerator(DoUpArgument)
> current "for i in List" will be just short form of "for i in List 
> using GetEnumerator"
But this complicate both: source and compilator.
And second: You cant pass enumerator as param.

procedure MyProc(aEnum: tObject);
   i : integer;
  for i in aEnum do



More information about the fpc-pascal mailing list