D vs Rust
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jan 29 07:39:53 PST 2016
qznc:
On Friday, 29 January 2016 at 09:00:52 UTC, qznc wrote:
> D is a broader language and is applicable in more situations.
> In many cases you don't care and don't want to care about
> memory management.
Learning to manage memory in Rust takes lot of time and practice,
it's a bit painful. I am sometimes able to write working D code
almost as quickly as Python code, but writing similar code in
Rust takes me much more time.
So I think for both small script-like programs, and general
application code (where code safety is not the most important
thing), D wins over Rust.
D is also more flexible (higher order templates, better CTFE,
unrestricted UFCS, etc), and you can port Python or C code to D
faster than to Rust.
So I think Rust targets a smaller number of coding purposes
compared to D. Rust could also replace the code you want to write
in OcaML, like compiler-like programs (thanks to Rust enums and
pattern matching).
Safety and correctness of the code are very important for me.
Regarding safety & correctness I think there's this ordering:
Rust > D > C++14 > C
If you talk about correctness you think about Ada too. Rust code
seems usually more succinct compared to Ada code. Ada is more
mature and it has lot of small features missing from Rust/D, that
help make the code more correct (like integer subsets, static
invariants, stronger typing for array indexing, SPARK annotations
to manage global mutables safely, and so on). I don't know if
such safety features will be added to Rust, I am dubious.
In the C/Ada world you have language subsets like MISRA/SPARK
that people use in high integrity system. I think Rust still
lacks something like that.
Bye,
bearophile
More information about the Digitalmars-d
mailing list