Why is D unpopular?
Antonio
antonio at abrevia.net
Fri Nov 5 15:54:53 UTC 2021
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/why_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
My answere: **Becaus it can't!**
Some D greatest features are rejected by common developers
(mainly for massive/productive profiles).
My favourite one is templates & mixins & compile time code:
People accepts to work with *generics*: a method signature is a
contract and generic types can be part of the signature. It is
easy to understand this:
```
IIterable<R> map<T,R>(IIterable<T>, (T)=>R fmapper)
```
The languajge itself offers a native way to describe
unambiguously what *map* accepts and returns... you can then read
the comments to see what "map" means.
Even if the language offers optional typing, in the end you can
deduce what each type is without actually compiling the code (the
intellisence system itself can deduce it from the source code)
**and D**
You see the D map signature: It is Template syntax, not Type
based signature syntax:
```template map(fun...)```
Then you enter in the code for details
```auto map(Range)(Range r) if (isInputRange!(Unqual!Range))```
What type auto refers? ... the "if" signature part tells us about
verification methods, not Type dependent contracts. Ok, let's
enter in the code more and more
```return MapResult!(_fun, Range)(r);```
Because Range is a "generic" type and previously you know it
verifies isInputRange... then it refers to an InputRange. Good:
auto is an input range :-)
But What exactly is an InputRange... is it an Interface? no: you
must enter in the isInputRange implementation to see more details.
Good... but then... what is fun?
...
Of course, you have the documentation and the large descriptive
comments that explains what signature can't and a complete
chapter about ranges to understand how they work.
**My point:**
D introduces a different philosophy: you must accept
**conventions**, don't expect to find Interfaces... That is not
what a regular Scala/Typescript/Java/C#/... developer is used to
seeing. It is a paradigm itself: your project will define more
and more conventions (without the help of languaje native
contracts) and compiler will check them.
Languages like Scala 3 or Typescript introduces new strong type
flexibility with "union types" (i.e.: sayHello( who: "peter" |
"andrew" ): string | string[] ) or exploid the pattern matching
or .... but without losing the type based contracts
May be D is unpopular because it can't be popular.
More information about the Digitalmars-d
mailing list