Andrei's list of barriers to D adoption

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 7 09:12:42 PDT 2016


On Tuesday, 7 June 2016 at 15:15:03 UTC, Chris wrote:
> Features are important. Templates, for example, make writing 
> code in general and libraries in particular much easier.

Both C++ and D have simple macro-like duck-typing templates. I 
don't find that approach particularly impressive. Yes, I use it a 
lot, but templated programming in this fashion also easily get 
convoluted and having multiple levels of abstraction can reduce 
transparency and make debugging more difficult.

> You sound as if a wealth of features and good libraries were 
> mutually exclusive. They are not. The problems with Phobos are 
> not due to D's features but to a specific implementation (slow 
> algorithms) - like in any other language.

Well, D has some language features that probably should be 
library features (like slices) and some library features that 
should have been language features (like memory management).

However I was not complaining about "problems", but pointing out 
that system library APIs get out-of-date over time irrespective 
of the quality of the implementation. The more detached library 
features are from the core language the more likely they are to 
get out-dated.


> When writing software, it's important to have a wealth of 
> features to choose from so you can use the one that best fits 
> the task at hand.

Not really.

C++/D would have been better languages if they just cut all the 
pointless special casing and boiled the core semantics down to 
templates and functors.

C++ has at least boiled lambdas down to functors and are better 
for it.


> You realize that when you have to use a language with less 
> features, then it's repeat yourself, repeat yourself ...

Not true in my experience. Which languages have you used? 
Orthogonal minimalistic languages can be very expressive. 
Actually, it is often the opposite, because without that 
minimalism you have to special case a lot of stuff when similar 
entities cannot be treated the same.

However in some minimalistic languages everything looks the same 
(like Lisp) which can make it harder to read source code. 
Sometimes you want a DSL for readability. However I don't think 
C++ or D score high on readability. It is not their core strength.

I don't find C++ std or Phobos particularly readable. I can read 
it, but neither provide shining examples of legible code.


> Java has lambdas now (since version 8, I think) and I read 
> somewhere that it's not certain that Java programmers will 
> adopt (i.e. use) them at all.

So, Java was designed to be a simple language, just like the JVM 
is simple. Lambdas aren't anything special. Most languages have 
anonymous functions. Even the minimalistic OO ones.


> D has the advantage that its users are not so complacent and 
> actually demand and welcome new features and happily use them. 
> They're not lulled into believing that this or that feature is 
> useless.

Uhm... Do you really think this reflects reality? You mean the D 
language designers and fanbois don't try to cut people down when 
they point out where D needs improvement? ORLY???


> This is why D evolves somewhat faster which helps to attract 
> users who look for something different, who are not happy with 
> the status quo.

But it doesn't evolve much, it adds features without fixing what 
is already there. Which makes it harder and harder to make any 
significant progress on the language semantics.

C++ actually do improve on the existing features, lambdas was 
improved in C++14 and further improved in C++17 (constexpr). And 
C++'s take on lambdas is better than D lambdas. Despite C++ not 
being able to push breaking changes, which D can (D's major 
advantage over C++).

If D improved on the existing feature set then it could stand a 
chance. Like, it could provide better integer semantics than 
C/C++, but chose not to. It could provide better floating point 
semantics than C/C++ (not hard to beat, as gcc/clang messes up 
rounding modes), but chose to stick with something even worse. 
The only advantage D has in the template department is the 
ability to select class-members using meta-programming. 
Everything else you need for practical meta-programming can be 
done just as well in C++.

If you compare current day D to C++ it only have two advantage 
points:

- static if

- a naive garbage collector

But D lambdas are worse, floats are worse, ints are worse, simd 
support is worse (gcc/clang) and documentation is worse.

Please understand that I am not saying that C++ is really great, 
but D is deliberately not trying to be better, but for some 
reason choose to just be "somewhat different". That cannot work 
out to D's advantage as both languages have too many pitfalls to 
be suitable for newbies (in comparison to high level languages).

As such, Go is better than C++ in some domains by being dependent 
on GC and stripping down features to the essentials. Go is very 
unexciting, but they stuck to improving on some core competitive 
features over time. Which paid off in that niche as other 
languages cannot get those features within 3 years.

D needs to improve too. Not by growing the feature set, but by 
improving on what is already there.



More information about the Digitalmars-d mailing list