[fpc-pascal] Forin Test

Paul Ishenin webpirat at mail.ru
Sat Nov 7 12:43:27 CET 2009


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.

  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"

Best regards,
Paul Ishenin.



More information about the fpc-pascal mailing list