<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 01.11.2015 00:11, Jonas Maebe wrote:<br>
</div>
<blockquote cite="mid:56354A9E.5060001@elis.ugent.be" type="cite">On
31/10/15 21:28, Ondrej Pokorny wrote:
<br>
<blockquote type="cite">The argument that the tenumeratornode
concept is completely different
<br>
from other nodes is correct - but if you think about the syntax
you will
<br>
see that also the syntax is completely different from other
pascal
<br>
syntax so you need such a unique node.
<br>
</blockquote>
<br>
That is a very good argument not to add it...<br>
</blockquote>
<br>
Yes, my argument that the "syntax is completely different from other
pascal syntax" is misleading. I put it wrong. It is not different -
its a new extension within the current pascal syntax:<br>
<br>
E.g. the code<br>
<b> for s in Self.StringArray do</b><b><br>
</b><b> Writeln(s);</b><b><br>
</b> would compile even now if <b>StringArray</b> was an "array of
xyz" or a class/record/interface with GetEnumerator function. The
syntax is already present in Pascal. I only want to extend it for
array properties (this extension is new and unique).<br>
<br>
The fact that the syntax is unique ensures that no legacy code can
be broken. I personally don't think that adding many new compiler
features is necessary, but this one really is useful - with this
syntax you could easily and systematically add enumerators to a lot
of different properties in the RTL/LCL you cannot use in a for-in
loop now:<br>
- TWinControl.Controls<br>
- TStrings.Names<br>
- TStrings.Objects<br>
- TStrings.Values<br>
- TStringGrid.Cols<br>
- TStringGrid.Rows<br>
- TStringGrid.Cells<br>
- etc, etc<br>
<br>
Michael liked it as well:
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/pipermail/fpc-devel/2015-October/036110.html">http://lists.freepascal.org/pipermail/fpc-devel/2015-October/036110.html</a><br>
<br>
---<br>
<br>
+ I was wrong about the need to use "tenumeratornode". Actually you
can use "tcallnode" and get <b>pd</b> and <b>expr</b> for <b>create_enumerator_for_in_loop</b>
from its properties in function <b>create_for_in_loop</b>:<br>
expr:=tcallnode(expr).methodpointer;<br>
pd:=tprocdef(tcallnode(expr).symtableprocentry.ProcdefList[xyz]); //
(you have to find the compatible overload)<br>
(If you don't know what I mean I can send you the code. It's working
like a charm.)<br>
<br>
The only thing we need is a new flag/whatever so that <b>create_for_in_loop</b>
knows that "tcallnode(expr)" contains an enumerator function.
tnode.flags seems to be full :( Do you have any suggestions? If we
sort this out, 2 more arguments against it are nil :)<br>
<br>
Ondrej<br>
<br>
</body>
</html>