I've working on a library to provide a new type, which is using advanced records.
Suddenly, operators like minus and greater-than are calling the wrong function.
For example, I have a record type like this:
T1 = record
private
var v: array of integer;
public
class operator subtract(const v1,v2:T1):T1;
class operator >=(const v1,v2:T1):T1;
end;
class operator subtract(const v1,v2:T1):T1; // implementation
class operator >=(const v1,v2:T1):T1; // implementation
Then, later in the code, when the following code is executed
var v1,v2:T1;
begin
v1:= 10; v2:= 5;
v3:= (v1 - v2);
at line 4, the >= function is called when I step through the code (when the subtract function should be called), then the value returned makes no sense, and the calling code fails.
I know its unlikely anyone will be able to help, but my head is spinning, and I've got no idea how to proceed.
The only clue I have is that the problem appeared to start when the definition of the advanced record was changed. It used to be like this
T1 = record
private
var v: array[0..3] of integer;
public
class operator subtract(const v1,v2:T1):T1;
class operator >=(const v1,v2:T1):T1;
end;
class operator subtract(const v1,v2:T1):T1; // implementation
class operator >=(const v1,v2:T1):T1; // implementation
With the new definition (at top) I had to start initialising the newly created type T1 vars with setlength on the internal array.