What are the prominent upsides of the D programming language?

glis-glis andreas.fueglistaler at gmail.com
Thu Sep 24 07:58:23 UTC 2020

On Monday, 21 September 2020 at 11:04:43 UTC, Imperatorn wrote:
> Top reasons to use D instead of for example Rust, Julia, Go etc 
> :)

I am working in computational sciences and a common use-case is 
working with a numeric code using MPI, OpenMP and/or CUDA 
(written in C++ in my case, can also be C or Fortran), and doing 
the pre- and post-treatment with python tools.

Pre-treatment is usually not very time-consuming as there are few 
input-files, but for post-treatment, you can easily end up 
running the same tools on 10⁴ - 10⁶ files. Even if a tool only 
takes 0.1s, multiplying this by 10⁶ is more than a day. When a 
python tool gets too slow, I usually rewrite the most 
time-consuming part in C++ and expose it through ctypes. This is 
working but not very convenient.

I was looking for a "more convenient" replacement of Python+C++ 
for some time, and replacing C++ with Rust was one of my first 
candidates. But at least to me, Rust felt even less convenient 
than C++ and solves problems I do not really have (basically all 
my data lives in arrays which get allocated at the start of the 
program and will remain alive until the end of the program).

Using a JIT-programming language, such as Julia or PyPy, does not 
help that much, as the same program is usually executed 10⁴ - 10⁶ 
times, doing just-in-time compilation every single time. Julia 
can do some caching but the startup-time is still rather slow.

In D, I found a language which combines the convenience of Python 
and the speed of C++, and basically removes the need of using two 
languages. I translated my most-used Python-tools to D and got a 
nice 1-2 orders of magnitude speedup.

For me, the key features I like about D are:
* Ranges
* Familiar syntax
* Pseudo-gradual typing: Usually, I start defining my functions 
as returning auto and template every parameter. Once the function 
is finished and passes the unit-tests, I start thinking about 

More information about the Digitalmars-d mailing list