Eliminate "new" for class object creation?

Adam D. Ruppe destructionator at gmail.com
Mon Oct 19 15:53:22 PDT 2009


On Mon, Oct 19, 2009 at 05:38:13PM -0500, Andrei Alexandrescu wrote:
> I hereby suggest we get rid of new for class object creation. What do 
> you guys think?

Didn't we go over this a few weeks ago? I think my preference would be
a bunch of templates in phobos that take new's job, and can also do different
allocation strategies.

The generic garbage collected one could even be called new, so

auto a = new Whatever(...);

can just become:

auto a = new!Whatever(...);

It'd be an easy enough change for users from C++ etc. to get used to and has
lots of potential for improvement down the line without changing the language
anymore.


> 
> 
> Andrei

-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list