Live data from Hacker News

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

news.ycombinator.com

151–160 of 262 posts

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

#151

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…

> The cost of this borrow checker is huge: every reference in every program needs to be annotation with whether it's shared or mutable

No. You need to "annotate" a mutable binding since bindings are immutable by default. But that also means that immutable bindings (ie the vast majority) does not to be "annotated". And even when you do need to, you literally just add the keyword `mut` as in `let mut foo = 42;`.

> and you often need to splatter confusing lifetime annotations all over the place. It adds a big learning curve to the language.

Again an extreme exaggeration. There are a few cases here and there where you need lifetime annotations, but most often the compiler simply infers them for you, allowing you to elide them completely. Specifically, you only need to do it yourself when it's ambiguous from which input(s) the output is derived.

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

#152

Because Rust is new and shiny. People who use Rust aren't using it to solve real world problems, they're using it to scratch a novelty itch. D is a tragedy in my opinion. It's an excellent language that just doesn't fit the political needs of any of the big players. We have Swift which is a worse version of C#, we have Go, we have Java. Why don't we have a single language so that we can do cross platform development…

> It's only a game developer of all people, Jonathan Blow, that's doing it and his creation is a C++ replacement for games, not general purpose software. Sigh.

That would still be huge. C++ keeps being used because of games. There's little to no C++ software being written nowadays that's not games.

And games are a gigantic industry, bigger than the film and music industries combined.

Many game developers would love the simplicity of D if there was a framework like Unreal but in D.

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

#153
post #139

Earlier quoted context omitted.

> But why does everyone want c++? Few "want" C++, but for robotics a non garbage-collected language is necessary so latency is predictable. There are few mature languages besides C/C++ in that category. Rust is an improvement, but I'm hopeful something like Julia (Julia Robotics, https://juliarobotics.org/ ) or Scala Native ( https://scala-native.readthedocs.io/en/v0.3.9-docs/ ) becomes mainstream, the productivity g…

For some reason Python seems to be very popular in academic robotics right now. Not a great choice

Being a "better, stronger, faster" Python is fairly near Julia's sweet spot... :-)

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

#154

Earlier quoted context omitted.

From my experience building (not writing) relatively complex Rust applications like Alacritty, it's really not that bad. Building for release is definitely slower than C++, but development builds are almost always instant for me, as they're done incrementally.

Rust is much better at caching the intermediate results of compilation. First time compilation might take some time, recompilation will be faster though.

Most of the time, I let my IDE check the code with rls, rust-analyzer or cargo check which invokes the rust-compiler without doing the costly code generation part with LLVM, so it is usually fast enough checking huge projects while writing or at least when saving.

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

#155

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…

Case study: awk. Brian Kernighan, who (co-)wrote the book on C, designed (with two others) another language, awk. Same organization (Bell Labs) pushing it as pushed C. C ate the world. awk... um... was available on all Unix installations, and got used for some things.

Sure, there are people who rave about how great awk is. I've read them here on HN. When you've got the right kind of problem, it's a great tool. But there are very few people for whom it is their main everyday language.

My point: Author/designer and organization can only take a language so far. At some point, the actual usefulness of the language determines how much it is actually used.

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

#156
post #28

Personally, at some point Rust was just clearly better and after a while - I lost interest in D. I don't have time to keep track of D catching up, when I'm so happy with Rust, and ecosystem is growing so fast. Maybe D got much better in last few years... but I kind of don't care anymore. It's hard enough to introduce a raising star like Rust to your coworkers and D just don't have traction anymore. I've been followin…

> Industry really, really needed C-like language that was memory safe, and all-round good: both low and high level. And Rust quickly delivered that

Well, almost. I'm not sure I like unsafe FFI and other bits.

> Personally, at some point Rust was just clearly better and after a while - I lost interest in D. I don't have time to keep track of D catching up

Yup. Better to use Rust if it's the one introducing the features.

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

#157

Earlier quoted context omitted.

From my experience building (not writing) relatively complex Rust applications like Alacritty, it's really not that bad. Building for release is definitely slower than C++, but development builds are almost always instant for me, as they're done incrementally.

Rust is much better at caching the intermediate results of compilation. First time compilation might take some time, recompilation will be faster though.

cargo doesn't do a terribly good job of caching dependencies.

Might be better than whatever C++ does though.

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

#158

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 just to learn a fancy new language with a weird ownership system?

lmao

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

#159
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…

Also D has a gcc backend.

Which is nice but it's still missing some of Rust's features.

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

#160
post #28

Personally, at some point Rust was just clearly better and after a while - I lost interest in D. I don't have time to keep track of D catching up, when I'm so happy with Rust, and ecosystem is growing so fast. Maybe D got much better in last few years... but I kind of don't care anymore. It's hard enough to introduce a raising star like Rust to your coworkers and D just don't have traction anymore. I've been followin…

> Rust would possibly not do so well if it wasn't for Mozilla support.

And especially Mozilla's intense passion for open-sourcing everything. I think it was a good catalyst to get it into the hands of as many people as possible.

Post reply on HN