[fpc-devel] for-in-index loop
Michael Van Canneyt
michael at freepascal.org
Thu Jan 24 18:45:04 CET 2013
On Wed, 23 Jan 2013, vrt277 wrote:
> Hi FPC team,
>
> There is good proposed extension of for-in loop on fpc wiki: get enumerator Position if available. From my point of view it's essential part of iterators.
> Especially for data structures which store pairs of key and value associated with key.
Enumerators are not iterators.
If you want a full-fledged iterator, you should use classes.
The for syntax is not meant for that.
> I want to implement this extension. Moreover I started implementation to explore fpc internals. Current (not finished) result available on github.
>
> My motivation is simple: I'm a student. My teacher is Alexander S. Klenin who should be well known to fpс developers. And I want to implement some feature of
> fpc as my graduate work. Through improvement of for-in loop is not enough for good graduate work but it is good initial step towards other big contribution.
>
> So is get enumerator Position if available good idea?
No. I think it is a bad idea.
If you want full fledged iterators, use classes.
Michael.
More information about the fpc-devel
mailing list