[fpc-devel] New feature discussion: for-in loop

Graeme Geldenhuys graemeg.lists at gmail.com
Sat Oct 24 23:26:38 CEST 2009


2009/10/24 Paul Ishenin <webpirat at mail.ru>:
> Enumerator can be found for type using:
>
> 1. GetEnumerator method to the class/object (delphi way). For example:
>
> type
>  TSomeClass = class
>  public
>    function GetEnumerator: TSomeEnumerator;
>  end;

Just to recap... What exactly does the function GetEnumerator return?
Specifically for list type classes. Also what interface would that
enumerator support?

The reason I ask... I would still like the full power of Iterator (as
discussed before) for all List type classes in the RTL (similar to my
code attachment of 4 days ago). I'm not sure if what you implemented
will conflict with what I want to implement in the RTL. The major
difference would be that mine is a implementation detail in the list
classes, whereas your implementation is a language feature. When I use
iterators, I would like to have the ability to use Current, HasNext,
HasPrevious, PeakNext, PeakPrevious, Reset, JumpToBack, pass a filter
to GetIterator... etc.

Also, I referred to them in my implementation as Iterators - as per
the Iterator design pattern. How does Enumerator differ from Iterator?

-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list