[fpc-devel]Proposal for audo-destructors
Marco van de Voort
marcov at stack.nl
Sun Sep 12 13:07:24 CEST 2004
> Absence of automatic construction/destruction of
> classes is very painfull and it can significantly
> degrade the
> development process (i.e. smart pointers and RAII are
> impossible).
Very painfull is a bit exaggerated :-)
> It's one of the greatest flaws of Pascal relatevly to C (the second thing
> are Templates of cource).
C doesn't do that. I assume you mean C++.
> Are there any plans for serious language
> extensions in this way for "post 2.0" releases of FPC ?
No. There is a big resistance against such features, mostly because
the benefits are superficial, and the idea is unpascallike.
Moreover it will be a Delphi incompability.
> P.S. The simpliest proposal for syntax for auto construction/destruction
> could be like (maybe with some restrictions
> on constructors/destructors):
>
> Procedure Something;
> Var T:tMyClass;Auto;
> Begin <- T auto created here
> ...
> If ... Then Exit; <- T auto destructed here
> ...
> End; <- T auto destructed here
>
> P.P.S. The "auto" modifier should affect only stack
> variables.
> There's no great need of this for global vars.
I don't like it. Either go the full way (like e.g. with ansistrings) or
don't go there at all. This is a hack.
More information about the fpc-devel
mailing list