Live data from Hacker News

What is Rust and why is it so popular?

stackoverflow.blog

21–30 of 284 posts

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

#21

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…

One major reason for the recent explosion is it's first class WASM support, especially since it doesn't need a GC.

It just has language features that make sense for the web, which is a huge sector. (parallelism, memory safety, speed, JS interop)

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

#22
post #10

Earlier quoted context omitted.

The compiler by its self can do it, if you run it. I believe the language server is just for real time editor integration.

Gotcha, thanks. This is too tangential to belong here. I need to go better understand what exactly the language server is doing if the compiler is able to provide all the details. Going to guess it has to do with partial/progressive analysis and supplying a programmatic interface to convert errors/warnings into squiggly lines rather than text output.

> I need to go better understand what exactly the language server is doing if the compiler is able to provide all the details.

Converting it from what the compiler knows to the https://langserver.org/ protocol.

The long-term goal is to have the compiler be able to do this directly, but there's some stuff to do in the meantime.

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

#24
post #16
post #12

Earlier quoted context omitted.

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

Weird, I did a search and I found 13,000 jobs mentioning Rust on Linkedin.

It's kind of how like when Go first bust out on the scene and every org that was "doing DevOps" claimed they had "Go in the building", the reality is you wrote CLI scripts and did 90% of your job in Java or Python. They may mention Rust, but doubt it's what you'll be solving the majority of business problems in.

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

#25

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?

Most of them are, yes. Some of them are not. We treat bad error messages as bugs, and track them, and have a few dedicated contributors working to make them better all the time.

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

#26

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?

In my experience, the vast majority are exactly like the error they show. Some are even better. I haven't hit a warning in ages that hasn't been able to be auto fixed by `cargo fix`.

However not all of them are. Back in the pre-async/await days you'd end up with some really gnarly implicit types in some really big functions with lots of returns. Then sometimes you'd make a mistake on one of the returns and the compiler would assume that your mistaken type was the right one & point out all the places where the actually correct type was returned. Then you'd have to go hunt for where you needed to add a `as Box>` to get it to compile again.

I haven't hit any issues like that since I started converting the gnarly stuff to infinitely simplier async/await code, but I have to imagine those kinds of issues are still lurking in other areas where you can't get away from complicated code.

Even with that I whole-heartedly recommend anyone that's thinking about it just go try it out and/or read some of the book. It's a delightful language to work with. I have way more fun working with Rust than I have with any other language. It takes care of so much of the BS that I don't want to have to think about, so I can just think about the interesting stuff.

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

#27

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 think that’s ok. It takes a while to figure out where a language is ok and where it’s maybe not ok. Also by doing stuff it may not be perfectly suited for right now there is an incentive for improving things.

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

#28

Rust newbie here. How do you fix the compile error for the example given? I imagine it has something to do with transferring ownership, but I’m not too sure.

The nickname works like alias that only shows 3 characters of the name. Before using nickname the code frees the name making both name and nickname invalid. The error here is use after free and one strengths of rust is to detect errors like this.

In C such code would compile, what's worse, it would work and behave correctly most of the time. If your code was more complex (for example using threads) you would get a bug that the code would work fine most of the time, but once in a while it would display garbage.

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

#29
post #14

Rust using the LLVM toolchain is a real plus, which Clang also uses in the C++ world. The Clang and Rust compilers are basically frontends to LLVM, and any language that compiles using LLVM is translated to IR (intermediate representation). All code optimization is done on the IR code itself in LLVM, which both Rust and C++ compile down to before being compiled further into assembly. That means that the same effort t…

We have started doing our own optimizations too: https://blog.rust-lang.org/inside-rust/2019/12/02/const-prop...

Your overall point is absolutely correct though. We couldn’t have done this without LLVM.

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

#30
post #5

StackExchange Inc. making noise to distract from the deepening crisis with the public Q&A sites it owns. The post itself may be good or bad, I don't know - but I just can't bring myself to read their happy-go-lucky banter.

What "deepening crisis" is this? Is it just the usual internet drama with a few people being unpleasant to each other and then storming off in a huff, or something more serious?

Some well-liked SF mod got randomly booted due to a CoC powerplay, and then everything exploded. Rules weren't followed correctly, mods getting kicked out or quiting in revolt, all sorts of corporate powerplays and misplays

Basically the whole stack overflow administration is fucked, but also no one really cares because that administration is mostly invisible to the majority of SF users (developers coming from Google). Same way Wikipedia drama has never been cared about by anyone but Wikipedia mods. General pop will only care once the quality of the system degrades

This article however probably has nothing at all to do with that, and is probably authored/published by a team entirely independent of the stack overflow mod administration.

Post reply on HN