Discussion about D at a C++ forum

Zachary Lund admin at computerquip.com
Mon Jan 9 06:47:13 PST 2012


On 01/09/2012 07:58 AM, Steven Schveighoffer wrote:
> On Sun, 08 Jan 2012 18:28:54 -0500, Mehrdad <wfunction at hotmail.com> wrote:
>
>> 7. Unstable language. They're currently considering doing things like
>> removing "delete" as it's apparently deprecated (which will officially
>> make it not usable as an SP language).
>> Looks 100% correct. Removing 'delete' /does/ make D unusable as an SP
>> language... unless you ignore the GC completely, which isn't even
>> possible, practically speaking.
>
> C doesn't have delete.
>
> But removing delete isn't the problem anyways. Here is the problem
> (which exists with delete present in the language):
>
> class C
> {
> private int[] buf;
> this() { buf = new int[5]; }
> ~this() {/* can't destroy buf here */}
> }
>
> void main()
> {
> auto c = new C;
> delete c; // doesn't destroy c.buf
> }
>
> What we need is a way to hook deterministic destruction vs. GC
> destruction. Only then, a SP language will you be.
>
> -Steve

I was under the impression you could overload new and delete per 
class/union/struct which gave you the ability to control how things were 
allocated.

I was also under the impression that this would be longer possible with 
some of the comments made on IRC. I'm probably wrong (or I hope I'm 
wrong...).


More information about the Digitalmars-d mailing list