[fpc-devel] Iterator for array properties
lazarus at kluug.net
Sat Oct 10 12:36:26 CEST 2015
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);
> Comp: TComponent;
> for Comp in Self do
> Just as an aside...
Yes, of course. I ment enumerator :)
TTest = class
property Objects[Index: Integer]: TObject read GetObject
property ObjectCount: Integer read GetObjectCount;
+ 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; **
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel