[fpc-devel] Iterator for array properties
    Ondrej Pokorny 
    lazarus at kluug.net
       
    Sat Oct 10 12:20:46 CEST 2015
    
    
  
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20151010/60c96c13/attachment.html>
    
    
More information about the fpc-devel
mailing list