On 10.10.2015 12:30, Michael Van Canneyt wrote:
After a

sed s/iterator/enumerator/g

I'm all for it.

I've been looking how to implement names/objects/values enumerators in TStrings. This would be the almost perfect solution.

But your example is not well-chosen, since the enumerator for TComponent already exists:

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

Just as an aside...

Yes, of course. I ment enumerator :)

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


+ Yes, the "in Self" is supported. But this is not the problem here. The example still doesn't compile. A class can have more array properties. And even the default class enumerators can be redeclared and so hide enumerators from ancestor classes.

Maybe a better example:

*Procedure TForm1.Button1Click(Sender: TObject); **
** var **
**  Cont: TControl; **
** begin **
**  for Cont in Controls do **
**    //... **
** end; **
***
Ondrej
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to