<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Den 23-01-2013 00:54, vrt277 skrev:<br>
</div>
<blockquote cite="mid:50FF2699.9080307@gmail.com" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div class="moz-text-html" lang="x-western"> Hi FPC team,<br>
<br>
There is good proposed extension of for-in loop on fpc wiki: <a
moz-do-not-send="true"
href="http://wiki.freepascal.org/for-in_loop#Proposed_extensions">get
enumerator Position if available</a>. From my point of view
it's essential part of iterators. E<span class="ref_result">specially
</span>for data structures <span class="ref_result">which store
pairs of key and value </span>associated with key.<br>
<br>
I want to implement this extension. Moreover I started
implementation to explore fpc internals. Current <i>(not
finished)</i> <a moz-do-not-send="true"
href="https://github.com/vkevroletin/freepascal/tree/key-value-iterator">result
available on github. </a><br>
<br>
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 <span
class="ref_result">improvement of for-in loop is not enough
for good </span>graduate work but it is good initial step
towards other big contribution.<br>
<br>
So is <a moz-do-not-send="true"
href="http://wiki.freepascal.org/for-in_loop#Proposed_extensions">get
enumerator Position if available</a> good idea?<br>
<br>
Thanks,<br>
Vasiliy Kevroletin<br>
<br>
<small> P.S. links for people who dislike computer mouse:<br>
<br>
proposed extension - <a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://wiki.freepascal.org/for-in_loop#Proposed_extensions">http://wiki.freepascal.org/for-in_loop#Proposed_extensions</a><br>
my branch on github - <a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="https://github.com/vkevroletin/freepascal/tree/key-value-iterator">https://github.com/vkevroletin/freepascal/tree/key-value-iterator</a></small><br>
</div>
</blockquote>
<br>
I think the idea is good if the feature is implemented as
"optional".<br>
<br>
That way:<br>
- If the enumerator class implements a CurrentIndex method then the
for loop can have an index variable.<br>
- If not then the for loop can only behave as current for in loops.<br>
</body>
</html>