When we are already discussing new language features, what about supporting iterators for array properties:

  TTest = class
    // ...
property Objects[Index: Integer]: TObject read GetObject *iterator GetObjectIterator*;
    property ObjectCount: Integer read GetObjectCount;
  end;

This would allow code like:

  for MyObject in Test.Objects do
    //...

In the LCL, e.g.:

procedure TForm1.Button1Click(Sender: TObject);
var
  Comp: TComponent;
begin
  for Comp in Components do
    //...
end;

This should actually be pretty OK and should not cause any regressions.

Ondrej
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to