Hacker News new | past | comments | ask | show | jobs | submit login

Because, faced with the fact that C++ makes an octopus by nailing extra legs onto a dog, D decided the right thing to do was to staple-gun them onto a cheetah instead.

D, at the end of the day, is C++ with cleaner syntax. Yes, you've gotten rid of headers and some of the syntactic ambiguities, but things that were mutable are still mutable, templates are still templates, hard-to-solve threading problems are just as hard to solve, etc. Indeed, I'd argue this is one of the reasons why C++ coders generally like D: it's the same damn thing with the most painful dumbth removed.

Rust, on the other hand, focuses on having different semantics from C++, in order to make certain problems much easier to solve. The big one is immutability, which makes code easier to reason about, and vastly simplifies multithreaded code compared to its D or C++ counterparts. But there are other major semantic differences, such as region pointers, the lack of nulls, and more, that really solve the semantic issues that crop up in C++ programs.

I know people who like D, and are highly productive in it, but Rust is solving a very different problem in a very different way.




D has extensive support for transitive data immutability, and function purity. (This is quite unlike C++.)


> things that were mutable are still mutable

`string` is immutable. You can use immutable everywhere if you like. C++ doesn't even have transitive const.

> templates are still templates

With constraints, unlike C++.

> hard-to-solve threading problems are just as hard to solve

Have you looked at D 2.0? Globals are thread-local by default, unlike C++. Implicit sharing is disallowed, unless immutable.

> region pointers

It's early days (perhaps I don't fully get region/borrowed pointers yet) but D's `scope` parameter keyword seems very similar. It prevents an argument escaping the function call.

> lack of nulls

This is the big one. Unfortunately D doesn't seem to have an answer on this. I understand Rust uses option/sum types for this, which seems like a great idea.


This isn't very relevant to the topic, but I wanted to thank you for the colourful and hilarious metaphor. Cheers.


This is why I'm excited to pick up Rust. I feel like Go makes it very easy for me to get running and churn stuff out with a simple syntax but Rust seems to be bringing in more of the "new" in CS and I want to give that a shot. Rust has surplanted my interest in D and this comment is pretty much exactly why. When I look at D I see a lot of C/C++ type things that make me go "Wait, I thought this was D and not C++ improved".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: