D vs Rust

cym13 via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 28 14:41:01 PST 2016


On Thursday, 28 January 2016 at 22:30:51 UTC, nbro wrote:
> I have loved C++ when I first started learning it a pair of 
> years ago (then I stopped for some time for some work reasons), 
> and quite recently I have discovered D, which seems apparently 
> a better language from the design point of view, especially in 
> supporting OO design and modularisation, maybe I am just wrong 
> since I know just a little of D so far, but I really had some 
> problems just in setting up a simple OO project, i.e. importing 
> classes, there are .h and .cpp files, etc, which only make 
> everything confusing and make you learn stupid things instead 
> of being productive. D also seems to have a cleaner syntax in 
> general. C++ is becoming more and more a mess because they keep 
> introducing new functionalities to make C++ compete with new 
> languages, and I'm starting hating it. Languages should not 
> just be powerful but simple enough to be productive.
>
> Apart from this, what are the real advantages of D over Rust? 
> They seem to be similar languages in what they want to achieve. 
> Rust seems to be younger and the syntax seems to be slightly 
> different from the C-like syntax. I am not such concerned or 
> interested with the syntax advantages of a language over the 
> other, but more about in general what one does better than the 
> other. Overall, which one has a better design and a more 
> promising future? Which one is more performant, in which 
> situations? If you could answer all these questions it would be 
> nice. I'm still deciding which one to learn and invest my time 
> on, but I would like to have also your more experienced and 
> expert opinion.

I don't really think they are similar in what they want to 
achieve. Rust wanted to achieve a zero-cost memory-safe model. It 
almost did. I said almost because the cost is on the programmer's 
side: you have to go out of your way and learn new mechanics to 
use it. It may be a good thing to use but it is clear that it 
needs you to develop new skills.

D on the other side wanted to be better than C++ but in the same 
way: if you like C++-style programming you'll be able to transfer 
those skills in D. If you like functionnal programming you can 
program in D. If you like java-style programming you can program 
in D. If you like C programming... well, you get the point. Of 
course there are things that will be different but porting a 
program from C doesn't imply rethinking the program: it's mostly 
some symbol substitutions. You won't have that with Rust.

The other point is that metaprogramming is way better in D than 
in Rust. Maybe Rust will eventually get better at it, but right 
now D is the best IMHO.

The last point is harder to explain... There is a D style, and 
that style is truely beautiful. I don't think it can really be 
explained, it has to be discovered, but no matter how much I try 
to learn something else I always find myself drown back to D.

Just my two cents :-)


More information about the Digitalmars-d mailing list