> On Jul 8, 2019, at 11:07 AM, Sven Barth via fpc-devel
> <[email protected]> wrote:
>
> As Pascal does not allow differentiating between result types this indeed
> needs to be/stay forbidden.
>
There actually is a need to distinguish between getters/setters but the way
property syntax works we’re forced for the return type to be the same as the
input for the setter. This is a problem I faced before where I want the getter
to return a pointer but I want the setter to take a direct value.
It could be solved by overloading but the syntax for the setter doesn’t make as
much sense.
type
generic TList<T> = class
public type
TReference = ^T;
private
function GetValue(index: integer): TReference;
property Values[index: integer]: TReference read GetValue; default;
procedure SetValue(index: integer; value: T);
property Values[index: integer]: T write SetValue; default;
end;
Regards,
Ryan Joseph
_______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel