What can you "new"

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Mar 23 11:04:37 PDT 2009


Georg Wrede wrote:
> Andrei Alexandrescu wrote:
>> Don wrote:
>>> Andrei Alexandrescu wrote:
>>>> new is a really bad construct. I'm very unhappy that D inherited it.
>>>
>>> Care to elaborate?
>>
>> I just did in the PS :o). New is not uniform: you can't use it easily 
>> to allocate a pointer to a dynamic array, or even a fixed-size array. 
>> Why? Because new is syntactically ill-conceived. It also allocates two 
>> keywords for no good reason.
>>
>> new should disappear and delete should be an unsafe function.
> 
> Have I missed a discussion on what to have instead of new?

Nothing.

auto a = T(args);

should create a T, whether T is a class, array, struct, what have you. 
This "new" business is lame, lame, lame.


Andrei



More information about the Digitalmars-d mailing list