Eliminate class allocators and deallocators?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Oct 8 07:35:01 PDT 2009


Jeremie Pelletier wrote:
> Yeah I agree now after reading most of this thread, I know that these 
> keywords just map to functions.
> 
> I've seen a proposal of a global new template somewhere, I don't like 
> that since at the global scope there are also structs, arrays and 
> whatnot that can be allocated by 'new'.

Well it's easy to handle all of those with conditional templates.

> I don't like the static new either since it prevents subclasses from 
> overriding their new/delete operations.
> 
> What would then be a good way to replace new/delete operators to still 
> have them overridable? Isn't that the convenience that first got them to 
> be used in the first place? Other than global new/delete overrides which 
> is plain silly in D.
> 
> I've pretty much found alternatives to all my other points against 
> taking out new/delete except for the override feature, find me an 
> alternative for that too and I'll be voting for new/delete to be runtime 
> function instead of language keywords, cause I can't think of anything 
> right now.

I think you'd find this article interesting:

http://www.ddj.com/article/printableArticle.jhtml?articleID=184405016&dept_url=/java/


Andrei



More information about the Digitalmars-d mailing list