Why is D unpopular?

Daniel N no at public.email
Mon Nov 8 20:25:51 UTC 2021


On Monday, 8 November 2021 at 18:02:27 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 8 November 2021 at 17:40:08 UTC, 12345swordy wrote:
>> class as a reference type makes sense as you are dealing with 
>> polymorphism.
>
> Maybe so, but you could have the same typing scheme. Just make 
> it a typing error to instantiate it as a non-reference type.
>
> So you could for instance collapse struct/class, yet allow the 
> programmer to specify that this particular struct/class can 
> only be instantiated as heap-object.
>
> And you could similarly put a ban on virtual members. So rather 
> than having special cases struct and class, you allow the 
> addition of constraints to a singular aggregate concept.

We are lucky we have class in D as ref is near useless in D 
meta-programming.

alias I1(alias T) = T;
alias I2(T...) = T;

I1!(ref int) i1; // RIP
I2!(ref int) i2; // RIP

I rest my case.



More information about the Digitalmars-d mailing list