Sorry to bring this up again but I had a thought today while working regarding
class operator overloads in classes (i.e. operators that are members of
classes).
If the operators in classes allowed another parameter for the left sided value
could this idea be more viable? Unless I’m mistaken I think this would make it
possible to do the memory management required.
============
type
TMyClass = class
public
class operator := (left: TMyClass; right: integer): TMyClass;
end;
class operator TMyClass.:= (left: TMyClass; right: integer): TMyClass;
begin
if not asssigned(left) then
; // allocate new
else
; // delete old and return new (or mutate)
end;
var
c: TMyClass;
begin
c := 100; // c := TMyClass.:=(c, 100);
end.
Regards,
Ryan Joseph
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel