From: riwu
Looks like a bug to me.
A temporary bypass would be to do
result:= High(self) + 1;
It isn't a bug at all. He has length defined for the tstringarray and he's trying to call length but instead is calling self.length(self). He needs to call global scope length on self.
If his Function was defined as follows:
Function TStringArray.Length(param: TStringArray): Integer;
Begin
Result := Length(Self);
End;
He'd have a stackoverflow due to infinite recursion. In other words, length(self) is actually calling itself and not the Global Length function which he is overriding.
Only solution I know of is to do:
Function TStringArray._Length(param: TStringArray): Integer;
Begin
Result := Length(Self);
End;
I don't know myself how to call global Length..