3 ms·
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 i
by gecko 14y ago
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.
- incredimike 14y agoThis isn't very relevant to the topic, but I wanted to thank you for the colourful and hilarious metaphor. Cheers.
- drivebyacct2 14y agoThis 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".
- WalterBright 14y agoD has extensive support for transitive data immutability, and function purity. (This is quite unlike C++.)
- ntrel 14y ago> 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.