Live data from Hacker News

What is Rust and why is it so popular?

stackoverflow.blog

141–150 of 284 posts

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

#141

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 are that good, or better. I actually debated putting that error because it's one that doesn't have a "help:" line that actively suggests how to fix it. Some errors are admittedly worse, and people like estebank are actively working on improving them.

FWIW, I think it was a good choice to showcase the underlying feature as opposed to showing off the diagnostics :)

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

#142
post #102

Earlier quoted context omitted.

No, that's not "Rust leakage", because that misbehavior has nothing to do with the semantics of Rust as a language. That's the effect of some non-optimized function-scope-level pattern-matching substitutions that LLVM is applying, as applied to the user's very large function body. Quoting a reply in that same thread: > LLVM is not good at big functions, I have seen this before as well. One of the functions you are ge…

> that misbehavior has nothing to do with the semantics of Rust as a language. Macros are part of the language; they aren’t an external code generation tool. > The same would happen if you wrote (or generated) 100,000 lines of C in one function body Absolutely, but neither C nor C++ makes it easy to generate such code. Technically doable with C preprocessor, but it’s not easy. C++ templates don’t normally expand into…

People write code generators that emit C/C++ code all the time, and 10KLOC functions coming from such a generator isn't unheard of. The x86 instruction selector LLVM generates from tablegen is over 240KLOC, although that's emitted effectively as an interpreted table, so the actual code size of the function is much, much smaller.

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

#143

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…

The key is in another comment on this thread: > Lots of these things that look like syntax problems are in fact design problems surfaced by the compiler. A lot of people are finding value in the rules Rust provides. This is irrespective of domain. The strict compiler helps you refactor code in ways that less strict languages don't. You still can do it, of course, you just have a lot less help. The trick is, is the in…

Rust is great and I'm really glad it exists; however, I'm skeptical that anyone ever "gets up to Python speed" or "gets up to Go speed", at least provided "speed" means "time to an acceptable result" and not "time to perfect" or "time to pacifying rustc". It's a laudable aim, but I don't think we're close. There's still a lot that Rust makes you think about that Python/Go/etc don't, such as memory management and lifetimes. Even if you are very good at thinking about those things, the cost isn't zero.

Of course, Rust gives you a lot in exchange for the reduced velocity--safety and performance; however, those are tradeoffs and we should talk about them as such. It feels dishonest to present Rust as "as productive as Python" even with the "(given enough experience)" caveat.

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

#144

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?

I'm one of the people working on UX and ergonomics. I would say that we aim even higher than what that output in particular shows. If an error could possibly be confusing to people, it gets reworked. Years past we spent a lot of time honing general common errors to a pretty neat level, then we moved on to detecting specific cases. I would say that the quality of the output is a bimodal distribution with a cluster of…

I really appreciate that people are thinking about language ergonomics in a serious way.

I've recently been using Flutter and it's a delight to get an error message like "you did X, but Y was uninitialized, so you need to put a call to Y.Z in your code first". When my problem is some conceptual mistake, a traditional error message, like "null pointer error in Y" just confuses me, because I don't even know what Y relates to what I'm doing.

I love that you and others are taking the time to see what really went wrong. Partly because it solves my immediate problem, but also because I know that's exerting backpressure on confusing language and library features, which I hope will drive more platform improvements down the road.

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

#145
post #68

This language is awesome, but I'm quite conservative when it comes to syntax. I don't like how Rust is trying to move away from C when considering syntax. I tend to prefer languages that can adopt the "C flavor". Python, in my view, does this very well: its syntax is simple, because it borrows a lot from C in its "flavor". Rust is not doing that, and that's a hurdle. In my view, the "C flavor" is very important becau…

I'm not sure I follow. Rust syntax seems far more similar to C than Python syntax does. What parts of the Rust syntax do you feel depart from C-style syntax?

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

#146

I work in the embedded space, but the majority of my work is writing simuators, mathematical models and tests. One of the hidden benefits for us was that rust is suitable for both resource-constrained embedded code (we use a lot of C for this) and high-level desktop and cloud based infrastructure/sim/test code, which we would never consider writing in C. Serde is amazing, crates.io has so much good stuff on it, C int…

Now switch to Julia instead of Python/matlab and you have a really solid stack.

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

#147
post #126

Earlier quoted context omitted.

What is the complexity, and what are its costs? As an active user of Rust, I haven't seen the (adverse) complexity or its costs yet. It's worth pointing out that Rust combats more than undefined behavior. Undefined behavior is a category of bad things that Rust works to eliminate, but Ownership goes beyond eliminating UB, and eliminates a large swath of potential logic bugs.

Programming in Rust is complex, I'm not sure how can argue against that, it is not straight forward to do simple tasks because of how you need to organise your architecture with the borrow checker. Most people that starts using Rust get stuck on issues that you woudn't have with other languages.

It’s not that simple. Rust’s rules also make more complex tasks specifically easier, at least for me. YMMV.

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

#148

Earlier quoted context omitted.

The key is in another comment on this thread: > Lots of these things that look like syntax problems are in fact design problems surfaced by the compiler. A lot of people are finding value in the rules Rust provides. This is irrespective of domain. The strict compiler helps you refactor code in ways that less strict languages don't. You still can do it, of course, you just have a lot less help. The trick is, is the in…

Rust is great and I'm really glad it exists; however, I'm skeptical that anyone ever "gets up to Python speed" or "gets up to Go speed", at least provided "speed" means "time to an acceptable result" and not "time to perfect" or "time to pacifying rustc". It's a laudable aim, but I don't think we're close. There's still a lot that Rust makes you think about that Python/Go/etc don't, such as memory management and life…

I feel like these days, provided there’s a library and I’m not writing stuff from scratch, I’m just as fast at Rust as I am with Ruby. I spent way more time debugging Ruby problems and fixing bugs than I pay upfront with Rust.

It really depends on how you measure productivity.

But also, I don’t think that “makes you think about memory” is that simple. I don’t have to think about memory in Rust very often at all: that’s what the compiler is for! When I make a mistake, it corrects me, and I’ve only thought about it for a few moments.

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

#149
post #76
post #65

Earlier quoted context omitted.

Which ones are more to your taste? For me it is mostly Zig which seems closer to what I want to see in a language. Crystal also looks promising but I prefer languages without GC. Rust is a good language but it is a bit too complex and restrictive at times.

Yep, Zig is the one I like, and IMO it's a language that shows an interesting yet very simple model for what systems programming can be. But I'll admit that it's easier to look good before you're put to the test in the field, so I'll wait and see what becomes of it.

As far as I can tell Zig is equivalent to a subset of C++ and thus completely lacks all the guarantees that Rust provides and several of the features that C++ has; so there is no point to use it instead of those languages.

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

#150

Earlier quoted context omitted.

I think you're asking rhetorically, but just in case: 1. Rust-the-language doesn't know anything about allocations, so strictly speaking, it cannot. Furthermore, without a GC, it's unclear how it could in the first place, given that a compaction would invalidate all pointers to that memory. 2. Certainly not to the same degree as the JVM, given that there's nothing inherently to inspect, like there is in languages wit…

> Rust-the-language doesn't know anything about allocations AIUI, Rust knows more about allocations than it should, since it's still limited to a single global allocator, and Box (which relies on that global allocator) is implemented via compiler magic and cannot be supplemented by equivalent library code. If Rust supported "pluggable" allocators in some fashion, fancy features (including heap compaction, although I…

Global allocator is a standard library concern, not a language concern, and Box is magic in only one tiny way that doesn’t actually have to do with allocation. Eventually that will be available to other libraries too.
Post reply on HN