Reddit: why aren't people using D?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jul 26 19:23:35 PDT 2009


Sergey Gromov wrote:
> 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

You may be making a confusion between assignment and copy construction.

Andrei



More information about the Digitalmars-d mailing list