Why is D unpopular?

Walter Bright newshound2 at digitalmars.com
Sun May 1 08:10:28 UTC 2022


On 5/1/2022 12:26 AM, Ola Fosheim Grøstad wrote:
> In C++ you use stdint which gives you 3 options for each bit width: exact, at 
> least or fast...
> Then you bind these in meaningful ways for you application using alias, 
> unfortunately C++ does not provide nominal binding, but D doesn't offer that 
> either so...

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.

>>> Thankfully consteval gives you full control over what happens when.
>>
>> That's the C++ rationale for consteval. But D allows 100% control over whether 
>> CTFE is run or not. consteval is completely unnecessary. It's simple - CTFE is 
>> run if otherwise the compiler would give an error message that it cannot 
>> resolve an expression at compile time.
> 
> Th difference is that I have functions that I only want to run at compile time 
> or runtime, in D you have to test it in the body, in C++ you are forced to think 
> about it.

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.

If you want to run a function at compile time, you don't have to test it. Just 
run it at compile time. We've had CTFE in D for 15 years now. None of your 
objections to it have caused a problem that has come to my attention. CTFE is 
used heavily in D.

The beauty of CTFE is it is so simple that Daveed and Bjarne missed it. You can 
see that in their proposals.


>> CTFE is conceptually a no-brainer. Run a function at compile time. That's it.
> 
> I agree that the concept is trivial, which is why it is surprising that people 
> think other languages haven't considered this option.

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

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?

Why didn't I invent Visicalc? It seems so obvious now. Ditto for all the FAANG 
zillionaires.

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.

A friend of mine who worked at a major company in the 90's would interview 
candidates. A question he'd ask was "what features would you add to this 
cellphone if you could?" Not one of them came up with anything other than things 
like "better voice quality". Nobody thought of using it as a radio, a music 
player, a book reader, a note taker, a voice recorder, a camera, and on and on. 
NOBODY!


More information about the Digitalmars-d mailing list