Board index » delphi » Delphi32 & Delphi.NET Should Both Have *Optional* Garbage Collection
Mike Vance
![]() Delphi Developer |
Delphi32 & Delphi.NET Should Both Have *Optional* Garbage Collection2005-08-09 11:36:04 PM delphi119 It would be very nice of Delphi was reimplemented so that it features memory management just like the D language is utilizing: Garbage collection is the default, but never imposed. This gives ease of use to those that wish to have garbage collection, but also allows programmers to manage their own memory if the programmer wishes. The syntax by which this is accomplished could be worked out easily enough. If the application were compiled for Win32 then the optional garbage collector would be included by the linker if it were required, or excluded if the application did not utilize it. Likewise, if the application were compiled for .NET and did not feature any programmer-managed memory allocations then the application would be compiled as a pure .NET app; otherwise it would be compiled much as the C++.NET apps are. The Win32 & .NET programmers would then be able to share most of their code without having to rewrite the management code. The syntax could be something like: MyButton := TButton.Create; // programmer will manage memory MyButton := new TButton.Create; // relies on garbage collection That would offer backwards-compliance, but if we are willing to go for the more "logical route", then perhaps backwards compliance should be broken and switch the meanings: MyButton := TButton.Create; // garbage collected object MyButton := new TButton.Create; // programmer-managed object Either way, there should be two ways of allocating an object: one for defaulting it to the garbage collector, and one for letting the programmer manage it. |