Reddit: why aren't people using D?

Sergey Gromov snake.scaly at gmail.com
Sun Jul 26 18:38:37 PDT 2009


Fri, 24 Jul 2009 16:58:50 -0500, Andrei Alexandrescu wrote:

>>>> deterministic destructors,  arbitrary copy constructors, and optional
>>>> lack of default constructor.
>>> Struct have that except for default constructor. In D, currently default
>>> constructors cannot execute code. This is a limitation that we might
>>> need to address, although it has some advantages.
>> 
>> There are things that copy constructors can do that the post-blit
>> operator can't do.
> 
> Yes, mostly wrong things. I think it would be a huge loss if D copied 
> C++'s model.

This means that structs cannot hold on external resources, ever:

    struct RAII {...}
    var a = RAII("foo");
    var b = RAII("bar");
    a = b; // you just leaked a and corrupted b



More information about the Digitalmars-d mailing list