[fpc-devel] Object upgrades
Ryan Joseph
ryan at thealchemistguild.com
Fri May 24 00:48:50 CEST 2019
I’m doing some work to upgrade old-style objects including class operators/management operators and better construction.
It’s natural to do ClassType.Constructor which translates to a “new” statement but not sure about what can be done for destructors. Maybe call the destructor directly like “o^.destroy” which translates to a “dispose” statement, or an implicit .free method? I assume this needs to be put behind a mode switch also.
Any ideas?
type
TMyObject = object
constructor Create;
destructor Destroy;
end;
constructor TMyObject.Create;
begin
end;
destructor TMyObject.Destroy;
begin
end;
var
o: TMyObjectPtr;
begin
// new(o, Create);
o := TMyObject.Create;
// what to do here???
o^.destroy;
// implicit free method?
o^.free;
end.
Regards,
Ryan Joseph
More information about the fpc-devel
mailing list