Why is D unpopular?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun May 1 14:36:12 UTC 2022


On Sunday, 1 May 2022 at 08:10:28 UTC, Walter Bright wrote:
> I.e. if you write portable code it is portable. But that wasn't 
> your complaint - which was about getting portability wrong. C++ 
> offers many more options for that.

The code wasn't wrong, it was C code that I ported to C++ and 
modified to be allocation free, so the delay lengths had to be 
known at compile time. If I had ported it to D, maybe it would 
have saved me a few key-strokes but I would not have realized 
that the delay-length was computed both at compile time and 
runtime. So I prefer consteval over constexpr for such cases 
because it gives *stronger typing*.

I like strong typing. I also don't like implicit conversion from 
int to float, and float to double, but it seems like the C-family 
are stuck on it.

Strong typing is very useful when you port or modify code written 
by others, or when you refactor your own code. A modern language 
ought to provide gradual typing IMHO so that you can increase the 
rigidity of the model as it evolves.

> I haven't made it clear. There is no ambiguity in D about when 
> a function is run at compile time or run time. None. Zero. It 
> is entirely unnecessary to add a keyword for that.

There is no ambiguity for the compiler, but that is not the same 
as programmers having a full overview of what goes on in a 
complex code base that they might not even have written 
themselves. *consteval* is just a stronger version of 
*constexpr*, what D does is roughly equivalent to making 
everything constexpr in C++.

> Many times obvious things are obvious only in retrospect, and 
> we get so comfortable with them we can no longer imagine 
> otherwise.

But in this case it is obvious. It is so obvious that people 
added macro-languages to their builds to get similar effects.

> I implemented modules in 10 lines of code for C. It seems so 
> obvious - why didn't I do it 40 years ago? I can't explain it. 
> Why did it take C++ 35 years to come up with modules?

Probably because C++ just was an addition to C and they got 
around that in a more generic way by introducing namespaces. I 
like namespaces btw.

The only reason to add modules to C++ is that people are 
undisciplined and #include  everything rather than just what they 
need. There are no technical reasons to add modules to C++, IMHO.

> I kick myself about Autotune. It's so obvious even the inventor 
> didn't think of it. His wife, a singer, casually mentioned to 
> him that it would be nice to have a device that fixed her pitch.

Autotune is more about fashion and marketing, being picked up by 
influential producers, at the time it became a plague the music 
market was accustomed to "electronic sound" on the radio.  Fairly 
advanced usage of phase vocoders and pitch-trackers were in use 
in music prior to this. There is a difference between existing 
and becoming fashionable. The original autotune effect sounds bad 
in terms of musical quality.  You could say the same thing about 
bit crushers (basically taking a high fidelity signal and setting 
the lower bits to zero) that create aliasing in the sound. Things 
that "objectively" sounds bad can become fashionable for a 
limited time period (or become a musical style and linger on).



More information about the Digitalmars-d mailing list