[fpc-devel]Proposal for audo-destructors

netsurfer at au.ru netsurfer at au.ru
Sun Sep 12 18:38:52 CEST 2004

>Again, what if you assign T to a global var or a 
class member ?
>Why would you want to do that?
>You still can declare "var T: MyClass" if you plan to 
use T as a local
>reference. Obviously you only declare variables as 
automatic when you
>want to bind its lifecycle to the current procedure.

The problem actualy is not in automated destructors, 
but in that the Class
types are actually pointers in Delphi OO model. That 
IS the hack, that makes some
tasty stuff impossible (RAII) or unconvinient 
(programmer has not to forget destructor).
Just have a look at "classes" and "pointers to 
classes" in C  . The problem is that
we have no similiar functionality for first ones in 
Pascal. That what i exactly meant
in my first post.

Sergey Kosarevsky
[Linderdaum Team]
netsurfer at au.ru

More information about the fpc-devel mailing list