Eliminate "new" for class object creation?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Oct 20 05:03:55 PDT 2009


Lionello Lunesu wrote:
> On 20-10-2009 6:38, Andrei Alexandrescu wrote:
>> I hereby suggest we get rid of new for class object creation. What do
>> you guys think?
> 
> I don't agree with this one.
> 
> There's extra cost involved, and the added keyword makes that clear. 

That's actually one problem: a struct constructor could also execute 
arbitrary amounts of code, so "new" is not as informative as it might be.

> Also, somebody mentioned using 'new' to allocate structs on the heap; 
> I've never actually done that, but it sounds like using 'new' would be 
> the perfect way to do just that.

Yah, I guess I'll drop it.


Andrei



More information about the Digitalmars-d mailing list