Live data from Hacker News

Ask HN: Why do you use Rust, when D is available?

news.ycombinator.com

101–110 of 262 posts

Re: Ask HN: Why do you use Rust, when D is available?

#101

Earlier quoted context omitted.

I’m currently trying to get into robotics. But why does everyone want c++? Surely robots can be programmed in other languages.

Rust is very very new compared to Cpp. People have decades of experience with cpp, learned in in University. Why would you throw all of that overboard just to learn a fancy new language with a weird ownership system? Keep in mind that people often still write cpp98 and have a rely hard time getting used to newer cpp concepts and programming styles. And all of that is backwards compatible with their existing codebase.

> Why would you throw all of that overboard

Firstly, because 75% of all that knowledge is easily transferrable.

Secondly, because you want to take 50% of your bug count.

Re: Ask HN: Why do you use Rust, when D is available?

#102

I know most people won't like this answer but the reason why rust is more popular now is because it had klabnik-san, mozilla, cargo and the super excited community. The same goes for go-lang. It throws away years of research into programming languages. While rust is a great language and deserve the popularity, do you think go would have peaked in popularity if there weren't rob-pike-san and google behind it. It's not…

> do you think go would have peaked in popularity if there weren't rob-pike-san and google behind it.

This is dismissing the fact that Go is the way it is because of Pike, Griesemer and Thompson and their common design process. You have to go out of your way to not appreciate the inherent simplicity and readability of the language and its minimalist, orthogonal features.

But I agree with you on the general sentiment, that a new language needs a lot of convincing. Rightfully so.

Re: Ask HN: Why do you use Rust, when D is available?

#103

For those you want the context of D please check its development history [1]. If history telling us something, python only take off after 20 years and now D language is around the 20 years mark. But fortunately D has passed the growing pain similar to python 2 to 3 when it transitioned to D2. Personally I think D just need a big breakthrough in a form of a killer application like Ruby with RoR, and Go with Kubernetes…

Chrome may be using a lot of active memory, but I don’t think it’s a result of poor programming practices. So I don’t see how switching to Rust would solve the problem. Unless Chrome has a memory leak problem. If anything, Chrome can just offload the contents of the unused tabs to the hard drive, and reload it when it becomes active again. But this will require a massive architectural change to the core program itsel…

Web pages have memory leaks, not Chrome itself.

Side note, but at least on linux, with both Chromium and Firefox, you can observe exactly this behavior- tab-based segregated memory management. The work was done on both engines over the past several years, works beautifully now.

The content of each tab lives in a separate process. Kill the process, see the tab marked failed in the UI. Reload the tab, see a corresponding process spin back up.

I keep dozens of tabs open and periodically kill the ones that creep to the top of ram use, both wired ram and virtual. Keeps me from going into swap.

Re: Ask HN: Why do you use Rust, when D is available?

#104
post #59

As far as I know, D does not have ADTs (algebraic data types, a.k.a. tagged unions, a.k.a. Rust enums). I see that it has "enums" and "unions", but neither of these appear to be ADTs if I'm reading them correctly. And Rust's borrow checker can give very strong guarantees that aren't present in any other mainstream language that I'm aware of. In Rust, you can pass mutable references to large data structures between th…

D's borrow checker is only semi-documented/WIP at the moment. https://dlang.org/blog/2019/07/15/ownership-and-borrowing-in... Basically D just needs that big break to actually get things done. There are some absolutely brilliant people working on D but there's only so much sweat people will donate (some people are paid but I imagine rust probably has upwards of a hundred full time staff given that Mozilla and Microso…

D does have smart people working on it, but like you said, maybe not enough. Walter Bright, creator of D, single-handedly created the first C++ compiler that compiled directly to machine code. Andrei Alexandrescu was on the C++ committee.

Re: Ask HN: Why do you use Rust, when D is available?

#105

The syntax is nicer. Granted, I'm not very familiar with D. I didn't even know it had a borrow checker. Rust took a lot of great features from Haskell, while keeping itself reasonably approachable from a C/C++/D/Java programmer's perspective. Rust put type names after variable/function/parameter names, which really cleans up the syntax nicely. Rust has very nice syntax for pattern matching, monads, and a slew of othe…

I was thinking about making a language with Rust syntax that compiled to D. ("Compile your Rust programs 10x faster!") You can replace "let" with "const" to get transitive immutability in D with type inference.

As a programmer who first used Python than C++, I don't find types after or before any nicer or worse.

As for Monads, you could write a template that wraps a pure function that creates side effects through its arguments into a Monad rather easily.

As for pattern matching, you can do that by writing your own template too.

Re: Ask HN: Why do you use Rust, when D is available?

#106
post #9

Engineers learn languages because of success stories by other companies—not by the merits of the syntax or one-off tricks like compiling itself in 5 seconds. The fact that Firefox uses Rust for the browser engine or that Dropbox uses Rust for the sync engine is the kind of thing that gets me interested.

Compiling extremely quickly will change your development experience to be like using a scripting language. As far as I know, D can still compile itself- and the entire standard library- in less than 5 seconds, with parallelism turned off.

Re: Ask HN: Why do you use Rust, when D is available?

#107
post #58

Earlier quoted context omitted.

I think you have to be updated. Rust has had success in countless places after Firefox/Dropbox. With that being said fast compilation times are amazing and must be a default in new languages. If not they should follow an approach like Dart where there is a VM for development and also a AOT compilation support for producing binaries.

There’s ongoing work for a fast debug back end called Cranelift. It emits code 20-50% faster than LLVM while being less optimised. Explained further here - https://jason-williams.co.uk/a-possible-new-backend-for-rust

D has a fast backend that omits assembly- it's DMD.

Re: Ask HN: Why do you use Rust, when D is available?

#108
post #41

Because there's a movement called "Rewrite everything in Rust"

If that is indeed the answer (and I don’t think it is), perhaps try to answer the question “why isn’t there a similar movement for D?”

Because we have a movement called "Make the D compiler compatible with all C++ code" https://wiki.dlang.org/Calypso

Re: Ask HN: Why do you use Rust, when D is available?

#109
post #81

Earlier quoted context omitted.

I've been writing C++ professionally for 16 years. I'm doing it right now in fact, but snuck on to HN while a build is underway. OP is right, unfortunately. C++ is a dying language. Mozilla, Microsoft and Google are all looking at Rust. Why? Because it's probably makes more sense to rewrite a buggy C++ component in Rust instead of updating it to use modern C++ (where admittedly, you have to go out of your way to get…

C++ was a dying language in the 2000s. But they turned it around with C++11. Now it has iterative 3 yearly updates and it's getting pretty good. It's far too premature to declare its death. The pace of development of C++ is decently fast and there's many stakeholders with millions of lines of C++ who are interested in C++ not dying. C++ is taught in universities around the world so the chance of C++ developers becomi…

The C++ that they teach you in universities barely gets you started. I wouldn’t count on those for a steady supply.

Re: Ask HN: Why do you use Rust, when D is available?

#110
post #55

Earlier quoted context omitted.

> Normal people don't want to touch C++ anymore. Only people that think that CVEs are "just fault of bad developers" (LOL) can still be considering C++ a good language to start new projects in. Deliberately inflammatory, and also false. 1. Rust has limited abstraction features to make it more approachable and implementable, but make it unable to express libraries that are easy in C++. This will not change soon, altho…

>Rust found a ready audience in people intimidated by C++, frustrated with the limitations of C, Java, and Go, and ready to try something wholly new. What about people not intimidated by C++ and want to switch to Rust anyway? Why have you discounted them? Do such people exist in your world view? Do you think there might be a good reason for those people to choose Rust?

I read that the same way until I realized that it would be fair to say that even I'm "intimidated" by C++ despite having quite a bit of experience with it. It's not a matter of cleverness or experience. You can know something inside and out, and still admit that it's out of control and worry about the costs of its complexity.
Post reply on HN