www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Why is D unpopular?

reply electricface <electricface qq.com> writes:
https://forum.dlang.org/post/axslxubumvtrudpjfpng forum.dlang.org

On Tuesday, 2 November 2021 at 17:27:25 UTC, Dr Machine Code 
wrote:
 It got [asked on 
 reddit](https://www.reddit.com/r/d_language/comments/q74bzr/
hy_is_d_unpopular/) sub but for those that aren't active too, I'd like you
opinions. Please don't get me wrong, I also love D, I've used it everywhere I
can and I'd say it's my favourite language (yes I have one...) but I'm as as
the reddit's OP, trying to understand why it's unpopular. Rust and Go seeming
to be getting more and more users. I think it's due to large ecosystem and the
big corporations with deep pockets that pushes them. But I'd like to know you
all opinions
Why is D unpopular? I think the current language is good enough, but the IDE for programmers is not good enough, not smart enough to read and refactor code easily.
May 14 2022
parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sun, May 22, 2022 at 02:51:24AM +0000, forkit via Digitalmars-d wrote:
 On Saturday, 21 May 2022 at 03:05:08 UTC, Walter Bright wrote:
[...]
 Asserts are *not* for validating program input. Please do not use
 them for that. They are for checking that the program's logic is
 correct. If an assert is tripped, it is a bug in the program, not a
 problem with user input.
I don't agree, that 'tripping an assert' == 'a bug in your program'.
[...] That's because you're using it wrong. Assert is for asserting an assumption that your program is in a particular state when you're about to execute some code. E.g., after computing a square of a number, you assert that the result is positive, because the subsequent code, that assumes it's positive, will otherwise produce nonsensical results. I.e., assert is for verifying that your algorithm for computing the square is correct, and hasn't produced a nonsensical negative value. If the assertion fails to hold, that means your squaring algorithm has a bug. For environmental things like unexpected user input or the OS returning an unexpected value, you should not use assert. You should use std.exception.enforce instead. On Sun, May 22, 2022 at 02:54:02AM +0000, forkit via Digitalmars-d wrote:
 On Sunday, 22 May 2022 at 02:51:24 UTC, forkit wrote:
 
 I'd use an assert where I don't want to handle any 'unexpected'
 conditions.
 
e.g. out of memory. no disk space left, etc...
You should not use assert for this. Use std.exception.enforce instead. T -- Obviously, some things aren't very obvious.
May 21 2022
parent forkit <forkit gmail.com> writes:
On Sunday, 22 May 2022 at 03:10:45 UTC, H. S. Teoh wrote:

An assert is useful in the context of a proposition about a 
program, where the proposition is asserted to hold.

That is all it is really.

I think people try to make more of it, than they should ;-)

e.g.

assert(something != NULL);

But I can handle this same proposition without an assert.

Some history:

https://people.eecs.berkeley.edu/~necula/Papers/FloydMeaning.pdf

https://dl.acm.org/doi/pdf/10.1145/987531.987535
May 21 2022