Den 23-01-2013 00:54, vrt277 skrev:
Hi FPC team,
There is good proposed extension of for-in loop on fpc wiki: get
enumerator Position if available
<http://wiki.freepascal.org/for-in_loop#Proposed_extensions>. 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.
I want to implement this extension. Moreover I started implementation
to explore fpc internals. Current /(not finished)/ result available on
github.
<https://github.com/vkevroletin/freepascal/tree/key-value-iterator>
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
<http://wiki.freepascal.org/for-in_loop#Proposed_extensions> good idea?
Thanks,
Vasiliy Kevroletin
P.S. links for people who dislike computer mouse:
proposed extension -
http://wiki.freepascal.org/for-in_loop#Proposed_extensions
my branch on github -
https://github.com/vkevroletin/freepascal/tree/key-value-iterator
I think the idea is good if the feature is implemented as "optional".
That way:
- If the enumerator class implements a CurrentIndex method then the for
loop can have an index variable.
- If not then the for loop can only behave as current for in loops.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel