Why is D unpopular?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Fri May 6 08:19:38 UTC 2022


On Friday, 6 May 2022 at 07:58:06 UTC, Paolo Invernizzi wrote:
> Doing thing at compile time with templates implies something 
> new and difficult to learn (see C++). Doing things at compile 
> time with CTFE don't add anything new to learn, you write code 
> as always.

Let us put this in perspective first.

Using templates for computations was not something the C++ 
designers wanted to support. In general, allowing programmers to 
execute recursion/loops at compile time is a serious liability 
for large projects.

1. In general, language designers want the compilation to execute 
in O(N) where N is the length of the source code.

2. There is no good solution to debug what goes wrong, so it 
certainly creates complications!

Those are two very good reasons for not adding CTFE.

Now, in C++ CTFE was inevitable because they have a large third 
party eco system where people started to use templates this way 
and it was becoming a language problem. So basically, it is a 
byproduct of a significant mistake in their original template 
design combined with having a large eco system of reusable code 
(libraries).

Basically, they had no choice, but to add it. When C++ adds it, 
there will be more demand for it because many programmers know 
what C++ has.




More information about the Digitalmars-d mailing list