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

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to