Why is D unpopular?
Guillaume Piolat
first.last at gmail.com
Sun May 1 13:35:46 UTC 2022
On Sunday, 1 May 2022 at 08:26:50 UTC, Walter Bright wrote:
>
> text
I think it is obvious to the casual observer that D had an
enormous influence.
After D, it became rare to have a new native language without
CTFE, fast build times, static if, or unittest blocks.
**My interpretation of CTFE prior from a quick research:**
2003:
If you read the EDG presentation from 2003 that does indeed
the same thing:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1471.pdf
What is transparent is that "metacode" is seen as code separate
from normal code, whereas one could say the D innovation is to
avoid this distinction, bringing it much closer in spirit to
LISP. And indeed for D programmers reflecting on the structure
of the program progressively becomes second nature after a few
years. Possibly core.reflect would enhance this effect.
EDG authors probably knew very well what they are getting into
and envision all it can do for native programming. However C++
doesn't get constexpr until 14 years later, with C++11.
2007:
CTFE was in DMD 1.006 (2007). Critically, as there is no
committee or implementers to convince, it can be adopted
immediately.
One could said the merit of D would have to have pushed
through the implementation, making it ubiquitous and so easy
stuff that wasn't ever written for meta-programming often works
on the first time ; and pushing other languages to have it.
When you are not the first ever to implement something but do
it in a way that has better UX, then you are doing more to
popularize the feature than just inventing it. It is a bit
strange the obvious syntax didn't take of likewise but maybe we
can attribute that to the "new thing => loud syntax" bias of
programmers.
And also, D tend to implement CTFE more completely:
https://nim-lang.org/docs/manual.html#restrictions-on-compileminustime-execution
With objects, reference types, pointers, floats, exp/pow/log...
(Bonus: the point of view of Nim designer:
https://www.mail-archive.com/digitalmars-d@puremagic.com/msg88688.html
Which of course could be possible as some ideas "float in the
air" to be independently (re)discovered)
**static if:**
The sanctionned way before static if / if constraints was
"policy-based design" and techniques popularized by Alexandrescu
in Modern C++ Design (2001). From then on "meta-programming" in a
C++ concept primarily looked like: "traits" + template
specializations + type lists (AliasSeq but recursive) and SFINAE,
with enormous damage done to C++ build times across the world.
Templates are much slower than CTFE to compile. Such a style is
very much non-LISPy, needing extra-data and headache instead of
code as data. D codebases have relatively few extra code
generators, but this is common in C++ contexts.
All in all, meta-programming in C++ used to be a very
different beast than in D, and didn't require expert knowledge.
Making it quite a cultural change vs C++.
**slices**
Go and Rust had it from the start, Nimrod got them etc.
I unfortunately lack the time to do a complete research about
prior, because it seems surprising to me no other native language
had them before D. I have a strong feeling that like other
successful features, the experience of D was strongly influencing
other designs.
In sharp contrast, there are less-impressive ideas that - like it
or not - were left behind:
- pure
- TLS by default
- shared
- transitive immutability
- insert features you hate here
More information about the Digitalmars-d
mailing list