Live data from Hacker News

What is Rust and why is it so popular?

stackoverflow.blog

191–200 of 284 posts

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

#191
post #39

Earlier quoted context omitted.

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…

> 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. What tools are these, and why haven't they been deployed across every C codebase to prevent memory safety bugs?

E.g. Trust-in-Soft, and while they're cheaper than a rewrite in Rust, and so they're also used more than Rust, especially in safety-critical software, they do require some effort. I don't know how much "every C codebase" is willing to spend to become UB-free.

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

#192
post #60

Earlier quoted context omitted.

At the 10 year horizon the grandparent was using, the ultra low end of MCU may be substantially more powerful, with possibly lowend AM or RISC V being the smallest thing you can find. At some point, packaging will dominate cost over silicon for such small MCU so a better silicon won't cost much more...

Packaging will dominate silicon costs? I see plenty of silicon chips directly soldered onto PCB's for the smallest and cheapest applications, i.e. no packaging whatsoever.

The entity that solders it received it on a tape most likely, in 10 year I can totally see a small 32 bit core costing less that that.

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

#193

Earlier quoted context omitted.

> because it’s new in the same way Haskell is new to a Java dev Do you have any hypotheses about why we don't see as much publicity for Haskell then?

Hey nice to see you here, your SO posts have tremendously helped me learn Rust. I think Haskell is just too abstract for most of us. I love Rust traits and see how it directly came from Haskell but I couldn’t learn Haskell even after like 3 serious tries. Maybe a good portion of the problem is in the documentation and not the language? That said, the extremist purity is simply impractical compared to Rust which gets…

You are quite welcome!

I can't add much to the Haskell part as I've only ever used it sparingly. In many aspects, I view Rust as only having one or two small things that are new (or at least new in a non-research programming language). Its big strength is combining a lot of existing good ideas in a principled manner.

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

#194
post #93

Earlier quoted context omitted.

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

It's mostly a hunch, based on a combination of lots and lots of factors. It's very difficult to explain. From a distance, "embedded" looks like a very homogenous field, but it's nothing like that. Some of the factors that contribute to this hunch -- but bear in mind that they don't apply everywhere in the embedded development space, nor equally, nor to every kind of device -- include: 1. A lot of resource-constrained…

Very interesting breakdown.

Do you think that Rust could instead help outsourcing? Similar to how Java's GC keeps teams away from segfaults, could Rust's safety guarantees give companies more confidence that an outsourced team's code would have fewer critical bugs?

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

#195

Still not hyped. The article does not show anything special or new about the language that would attract me personally. Type inference -- nothing new and exists in many other languages. Actually how about compile type inference not only in function bodies? :) Functional niceness with iterators -- also nothing new. It can be even more succinct and elegant in Scala for example. But Scala is not as fast you'd say! Yeah,…

"It is a niche feature" looking at C and C++ usage that niche is pretty huge.

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

#196

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…

I think this is misplaced causation. Don’t discount the fact that a significant number of programmers just like novelty and like Rust because it’s new in the same way Haskell is new to a Java dev. That said, Rust’s domain does seem wider than just systems programming. It has the right abstractions to be suitable for (edit: some ) higher level things like web apps. Personally Rust is turning into what I was assuming a…

> higher level things like web apps.

Frankly any language that makes me write "some string".into(), and all of the other nonsense of Rust, is not suitable for writing string processing applications (as opposed to utilities, such as ripgrep). The business logic of any Rust application that deals mostly with strings is hopelessly obtuse and/or obscured. Languages like Perl, Python and Ruby, or even JavaScript and Java, are more suitable.

Rust focuses on and succeeds at being an improved C++, no reason to use it for everything.

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

#197

Earlier quoted context omitted.

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.

You're the author of the blog post? Dunno if this is something you care about, but with JS turned off the code boxes are omitted (with no placeholders or other clues that something is missing.)

I am! It's something I care about, but not sure if there's something I can do about it. The code blocks are powered by a `` tag from GitHub's Gists. Unfortunately, I don't have the ability to edit that post without Wordpress completely removing those tags (I don't have appropriate permissions). I can ask for them to put `` tags, but don't know if that will really help.

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

#198
post #38

Earlier quoted context omitted.

I think that Rust's approach to safety -- soundly eliminate UB in safe code -- comes at the high cost of complexity. This affects how easy it is to write custom compilers (very important in the embedded space), but it is also not necessarily the best way to reduce bugs. For some, this cost is acceptable, and I'm sure some people may even welcome the high-level-looking code [1] that Rust and C++ support, but I think t…

> Rust is without a doubt a (much) "better C++" Huh? They are apples and oranges. Is Rust intended to provide "Direct mappings of built-in operations and types to hardware to provide efficient memory use and efficient low-level operations"? That's one of C++' design goals. If you change the design goals, you get different advantages and disadvantages. See more about the C++ design goals in this interview: https://www…

Yes, this is a design goal that they both share, and generally accomplish in similar ways.

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

#199

Earlier quoted context omitted.

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…

> I pay upfront with Rust. But you do pay up front! That's a big deal if your design is not set in stone (which is not a synonym for "prototyping").

I also think this is not a simple question; Rust’s rules provide critical feedback during that early phase. It’s valuable when getting started too. The prototype phase may last slightly longer, but I end up much closer to the final design with its help.

(Again, as always, YMMV.)

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

#200
post #187
post #157

Earlier quoted context omitted.

Zig's approach to safety is to optionally add runtime checks either in debug builds and/or in arbitrary code scopes even in product builds, rather than to try to soundly eliminate them. This means that the language can be drastically simpler. Some UB can escape this kind of unsound safety, but on the other hand the simplicity of the language makes the semantics of an expression easier to understand -- which may make,…

C and C++ have plenty of analogous checks- debug assertions in the standard library, runtime checks for uninitialized memory, sanitizers, etc. Do we have an idea how effective they are there? Do we have reason to expect Zig's to be any better? In fact, Rust approaches most of these particular problems the same way- arithmetic overflow, array bounds checking, stack overflow handling, etc. are all checked at runtime. R…

> C and C++ have plenty of analogous checks- debug assertions in the standard library, runtime checks for uninitialized memory, sanitizers, etc. Do we have an idea how effective they are there? Do we have reason to expect Zig's to be any better?

Yes. Take a look at some of the checks Zig has.

> Rust's language complexity is dedicated to things that Zig simply doesn't check, and that C and C++ have checked only recently.

Right, but that doesn't mean it leads to more correct programs when this "checking" comes at a cost.

> It has many of the same advantages as Zig (if not more) when it comes to understanding and code review.

That's a matter of taste. Those who like complex languages like, say, C++ or Scala, can certainly prefer them, but I think they're in the minority. Zig is a very simple language, while only C++ and Scala contend to be as complex as Rust or more.

> Painting Rust's static analysis and associated language complexity as an alternative to C/C++/Zig-style runtime checks looks like a category error to me.

If you, like me, don't particularly like complex languages, then the complexity has a cost. What does it buy you? It buys you certain sound guarantees about lack of UB is safe code, which hopefully helps write more correct programs. If you have an alternative to achieving a similar level of correctness with a much simpler language, I would very much prefer that.

Post reply on HN