Alexander Klenin wrote:
AFAIU, the whole point of the previous discussion is
that you do not have to implement "GetIterator" separately
from "GetEnumerator" -- you can have the same class filling both roles.
Yes. I think we can use some common interfaces/classes/objects in RTL both for the for-in loop enumerators and as iterators with all that methods which Graeme implemented.

I already created delphi compatible enumerator classes for the basic RTL lists: TFpList, TList, TStrings, TComponent and TCollection. We can inherit all them from the TInterfacedObject and Graeme interfaces. And list classes will have 2 methods: GetEnumerator: TSomeEnumerator and GetIterator: ISomeIterator where TSomeEnumerator implements ISomeIterator interface.

Graeme, what do you think?

Best regards,
Paul Ishenin.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to