Discussion about D at a C++ forum

Mehrdad wfunction at hotmail.com
Mon Jan 9 07:51:58 PST 2012


On 1/9/2012 1:02 AM, Jonathan M Davis wrote:
> I believe that the general idea is that if you want to manually manage memory,
> then you don't use the GC heap, though core.memory.GC will still allow some
> level of manual control for the GC. I'm not aware of any plan to add a
> "delete" function to anything, but if something like that is added, it'll
> probably be to core.memory with the idea that it's there if you really need it
> but that you really shouldn't be using it normally. Explicitly freeing memory
> goes with manually memory management, not garbage collection.
>
> - Jonathan M Davis

The precise trouble with that is that the _language_ DEPENDS on a GC in 
order to function correctly.

Arrays, AAs, closures, etc. use a GC for allocation, and essentially 
you're saying "don't delete AAs", even though that could very well be 
the memory hog in my program.
Object /also/ depends on a GC... yes, we have emplace(), yada yada, but 
it's is pretty darn un-handy to use (compared to placement new in C++, 
which is a breeze) so it's indeed quite a bit more difficult to use than 
in C++.

Unless you're saying I can't use AAs if I don't want a GC, then I don't 
see how that argument works out.


More information about the Digitalmars-d mailing list