Live data from Hacker News

What is Rust and why is it so popular?

stackoverflow.blog

41–50 of 284 posts

Re: What is Rust and why is it so popular?

#41
post #34

Over the last couple of months I've been slowly, but steadily playing with Rust. I work on embedded systems and while it's gaining traction only slowly, it feels to me reasonably likely that we'll be seeing non-trivial applications in the next 8-10 years. I doubt that we'll see it used for low-power/resource-constrained firmware, but lots and lots of embedded systems are now bulky Linux boxes with years of uptime, an…

We’re already using it in production for embedded development (on stm32 MCUs). So are a lot of other people. It lets you target a niche between spaghetti code on bare metal and structured and full-blown runtime/framework, making something along the lines of reusable libraries for bare metal without a runtime or OS possible via its zero-cost types.

Re: What is Rust and why is it so popular?

#42

Rust is a great language if you use for what was intended, system programming and as safe substitute of C and C++. But it's not the answer of everything, to me it's nowadays abused in a lot of projects, there are instances of project where using Rust not only doesn't make a lot of sense but also can be slower than another languages, there are cases where Go is better, other where Node.js is better, other where Python…

I don't recall seeing the community arguing strongly for re-writes. I see people who want to do rewrites for fun/education. For example, just because they love the language and prefer to work in it. In some cases people make the case for re-writing sensitive libraries in Rust, but I think a) they are not in general arguing confrontationally; b) they tend to have a point technically speaking. The missing piece is whether it makes sense long-term, with different pools of potential contributors etc.

Re: What is Rust and why is it so popular?

#43

The example of an error message in the blog post is the kind of thing that makes me seriously consider trying out rust. It's excellent. Are most rust error messages like that?

Yep, I think the only error messages I've seen that weren't easy to read are the old Futures error messages that could easily have type signatures multi-lines long, and some macro errors that say something like "this macro generated an error outside this crate". Even without something like a language server or full-fledged IDE, you can do "error driven development" where the compiler tells you what line has an error, and gives you a suggestion on how to fix it.

Re: What is Rust and why is it so popular?

#45
post #12

The more pressing question: What is Rust and why is it so popular on HN?

I did an internet search for Rust jobs and it was near-zero. Would be nice but reality calls.

Not everything has to be about employability. You can still write code to scratch a personal itch, or for the pleasure of the craft.

But actually a lot of the big tech companies are using rust, they’re simply not advertising jobs.

Re: What is Rust and why is it so popular?

#46
post #34

Over the last couple of months I've been slowly, but steadily playing with Rust. I work on embedded systems and while it's gaining traction only slowly, it feels to me reasonably likely that we'll be seeing non-trivial applications in the next 8-10 years. I doubt that we'll see it used for low-power/resource-constrained firmware, but lots and lots of embedded systems are now bulky Linux boxes with years of uptime, an…

> I doubt that we'll see it used for low-power/resource-constrained firmware I'm curious what your reasoning is for saying this?

Are you going to use Rust on a PIC12 with 32 bytes of data memory and max 256 code instructions? Of course not. Assembly is still king in this low-powered embedded class and will stay as such for the foreseeable future.

Re: What is Rust and why is it so popular?

#47
The reason that it's popular is that it's immediately clear that Rust's model of memory safety without a GC and safe concurrency is the best way to create a programming language since it unifies the memory safety of GC languages like Java, the efficiency of C and the concurrency of message-passing systems like Erlang in a single language that has none of the drawbacks of those systems.

Before Rust, everyone simply assumed that it was impossible to create such a programming language since it would have otherwise been what everyone used, and now that it turns out that it's possible, it's clear that it's the best solution and what should be used in the future whenever possible.

Re: What is Rust and why is it so popular?

#48
post #4

I think one of the biggest benefits of Rust is it bakes in static analysis of code as a first class feature. Which means the language is amenable to analysis and you don't have to use third party tools to benefit from it. I also like some of the abstractions. They're clever in their simplicity. For example, an iterator over an array or vector is simply doing a for loop using pointers.

> it bakes in static analysis of code as a first class feature.

This is basically what all type checking does. It's not specific to Rust.

Re: What is Rust and why is it so popular?

#49
post #4

I think one of the biggest benefits of Rust is it bakes in static analysis of code as a first class feature. Which means the language is amenable to analysis and you don't have to use third party tools to benefit from it. I also like some of the abstractions. They're clever in their simplicity. For example, an iterator over an array or vector is simply doing a for loop using pointers.

I'd like to understand what you mean by baked in. Not only does vscode need a plugin, it needs a language server running to do the static analysis. Are there analysis capabilities without the language server?

The other important aspect is that even if you have a static analyzer available, people might not be able to afford them (Coverity/klockwork/etc licenses) or even if they have it, there is nothing preventing them from skipping the analysis (just for this one time, I promise). (Another trick is to run the static analyizer, and not fixing the issues found...)

With Rust the compiler is already providing a lots of analysis, and you can't easily skip it. And if you do by using unsafe{}, it shows. So basically, even if your dependencies are provided by the worst team in the world, you know that the guarantees enforced by the Rust compiler are in the code. (To be fair, it does not mean that the SW will do anything useful, but it won't likely segfault)

Re: What is Rust and why is it so popular?

#50
post #39
post #4

I think one of the biggest benefits of Rust is it bakes in static analysis of code as a first class feature. Which means the language is amenable to analysis and you don't have to use third party tools to benefit from it. I also like some of the abstractions. They're clever in their simplicity. For example, an iterator over an array or vector is simply doing a for loop using pointers.

Yes and no. It provides some kinds of (important!) static analysis out of the box, but at the cost of complexity, which directly adversely affects some other kinds of (also important) static analysis. For example, there are sound static analysis tools that guarantee no undefined behavior of C code, but AFAIK, such tools can at best only work on a subset of C++, because of its complexity. Rust goes all out on eliminat…

Also, ownership checking only seems to work well for tree-like datastructures, but implementing something with cycles (back-pointers) immediately leads to nasty problems.
Post reply on HN