Stroustrup is disappointed with D :(
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Wed Sep 23 06:14:54 PDT 2015
On 9/23/15 2:06 AM, Ola Fosheim Grøstad wrote:
> On Tuesday, 22 September 2015 at 23:21:20 UTC, Steven Schveighoffer wrote:
>> Yeah, but you can't do this in C++ though:
>>
>> class D : B {
>> this()
>> {
>> writeln("derived is only now complete");
>> super();
>> }
>> }
>>
>> I find the ability to control the construction order far more
>> important than virtual calls for base constructors.
>
> You could do it in old C++ compilers, and some have a permissive switch
> that allows you to do it, but you should not do it. It leads to
> incorrect initialization and breaks encapsulation (unsound typing).
> Forcing construction order is a Good Thing.
You can do it in C++ via initializers too, just not as useful. D still
enforces sound construction.
-Steve
More information about the Digitalmars-d
mailing list