<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 21:03, Ondrej Pokorny
wrote:<br>
</div>
<blockquote cite="mid:56367003.20102@kluug.net" type="cite">You
cannot assign an array property to a variable. It does not exist
without the index parameter.</blockquote>
<br>
OK, there is a bug in ppc that allows to use an array property with
<b>any paramete</b><b>r(s)</b> (also no parameter). Delphi does not
allow it.<br>
<br>
Actually ppc doesn't check if <b>MyProp[Index]</b> matches the
property declaration but if there is an (overloaded) function that
matches the Index parameter. Therefore you can declare a
parameterless function with property getter's name that returns the
enumerator and it will be used in the for-in loop!<br>
<br>
I still think that it is a ppc bug and it would be better to have a
clean way to do that. But if you don't like to extend the compiler,
please don't fix this bug either.<br>
<br>
It was still a good practice for me to play with the compiler. I
wouldn't have found the bug without studying the compiler code. You
can find demo code that shows how to create an array property
enumerator in the issue report:
<a class="moz-txt-link-freetext" href="http://bugs.freepascal.org/view.php?id=28820#c87065">http://bugs.freepascal.org/view.php?id=28820#c87065</a><br>
<br>
Sven Barth & Michael Van Canneyt: you also showed an interest.
What is your opinion about it?<br>
<br>
Ondrej<br>
</body>
</html>