deprecated delete and manual memory management

Daniel Gibson metalcaedes at gmail.com
Wed Apr 27 13:42:59 PDT 2011


Am 27.04.2011 22:41, schrieb Daniel Gibson:
> Am 27.04.2011 22:37, schrieb so:
>>> It'd create template bloat and uglier syntax (expecially confusing for
>>> people coming from about any other popular OO language) for a really
>>> common, standard feature.
>>> These drawbacks are acceptable for custom allocation and other stuff the
>>> average user shouldn't care about, but not for an elemental feature like
>>> "new".
>>>
>>> Cheers,
>>> - Daniel
>>
>> For the template bloat, yes that would be a problem.
>> But it is not ugly! Take it back! :)
>>
>> auto a = new A;
>> auto a = new!A();
>>
>> auto b = new B(5);
>> auto b = new!B(5);
>>
>> For the confusion part, the real confusion (rather shock) awaits when
>> they get to the part where they see "new" but no "delete".
>> We could argue against this all the way, but to every single of us "new"
>> and "delete" are a pair.
> 
> No, in Java and C# there's no delete.

Also, new (== creating a new Object on the heap) is a standard feature
in D that is needed all the time, delete (== manually destroy and
deallocate an Object) isn't.


More information about the Digitalmars-d mailing list