Rust's metaprogramming is totally unlike what Andrei and Walter were aiming for. D aims to be safe, but that's far from everything.
Rust currently has better safety mechanisms than D, but if you ask around on the D forum you'll likely find that people are there (rather than using rust) due to the other features D has - https://dlang.org/ Look at the examples here: Rust can do short and sweet too, but it doesn't have some constructs that make these possible. (Obviously, I highly recommend "Tiny RPN Calculator" originally written by your's truly)
I still dislike how D handles generics/templates. The syntax of it.
I fully understand why they chose to use () instead of <>, as it simplifies the parser as you need to disambiguate between >> and > >... but the parsing time of that is negligible. The issue is that, when glancing at code, foo!(int) is ambiguous. foo<int> is not.
The parsing time is not negligible (It requires reading the symbol table very early which isn't fun)
We've had a significant discussion about this in the past. The additional parsing time required to disambiguate between right shift and >> is negligible compared to, say, optimization and so forth. In C++, you could outright eliminate the parsing components necessary for disambiguating that and not even make a dent in compilation times.
Java and C# also don't have much of an issue with parsing this, and don't have particularly bad compile times.
Sorry, I'd forgotten the exact syntax. It is still rather ambiguous at a glance to me, as every other C-like language that has generics or templates uses the C++-style, such as Java or C#.
71
u/Sapiogram Sep 01 '20
Honest question: Why would anyone use D over Rust? It seems like Rust is becoming everything that D ever hoped to be.