<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 28/06/2019 00:09, Ben Grasset wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAL4d7FhkHrzMX_FEhA8vjiWqH4E3X+U9NJeUPk+EzDfKnVAh0w@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">On Thu, Jun 27, 2019 at 4:12 PM Martin <<a
href="mailto:fpc@mfriebe.de" moz-do-not-send="true">fpc@mfriebe.de</a>>
wrote:<br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
Are indexes to properties intentionally allowed to take "var
param"?<br>
Btw it even compiles with an "out" param.<br>
</blockquote>
<div><br>
</div>
<div>"Var" and "Out" seem bad, although I've always though
that "Constref" *should* be allowed. </div>
</div>
</div>
<br>
</blockquote>
<br>
Most property index are simple types. So you would not need it.<br>
<br>
But *** hypothetically speaking *** constref (and const too) could
be given in the getter, but not in the property<br>
TFoo = class
<br>
private
<br>
function GetFoo(constref AIndex: Integer): Integer;
<br>
public
<br>
property Foo[AIndex: Integer]: Integer read GetFoo;
<br>
end;
<br>
The compiler woull simply (nothing is ever simple ;) ) need to know
that the signature is still valid, even with the constref.<br>
Of course the compiler accepts any data type as valid for the index.
So you could declare a big record for the index, and argue for
constref. I don't really think it is needed.<br>
<br>
<br>
Another one, that arises suspicion for its validity: open arrays.
They can only be declared in parameter lists for procedures and
functions.<br>
Oh and in properties:<br>
TFoo = class
<br>
private
<br>
function GetFoo(AIndex: array of Integer): Integer;
<br>
public
<br>
property Foo[AIndex: array of Integer]: Integer read GetFoo;
<br>
end;
<br>
<br>
</body>
</html>