Eliminate class allocators and deallocators?

dsimcha dsimcha at yahoo.com
Tue Oct 6 11:24:29 PDT 2009


== Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
> Hello,
> D currently allows defining class allocators and deallocators. They have
> a number of problems that make them unsuitable for D 2.0. The most
> obvious issue is that D 2.0 will _not_ conflate destruction with
> deallocation anymore: invoking delete against an object will call
> ~this() against it but will not recycle its memory. In contrast, class
> deallocators are designed around the idea that invoking delete calls the
> destructor and also deallocates memory.
> So I'm thinking of removing at least class deallocators from the
> language. Class allocators may be marginally and occasionally useful if
> the user takes the matter of deallocation in her own hands.
> A much better way to handle custom allocation of classes would be in the
> standard library.
> What do you think?
> Andrei

Please give at least a little more detail.  I think it's an absolute must that
advanced users who really want to do manual memory management in D (even if they
want to only do it selectively and without kludges like using two completely
separate heaps) be able to do so.  I can't really comment until I know at least
roughly what a standard lib solution might look like.



More information about the Digitalmars-d mailing list