Live data from Hacker News

What is Rust and why is it so popular?

stackoverflow.blog

231–240 of 284 posts

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

#231
post #224

Earlier quoted context omitted.

It is, and C/C++ are used in so many areas which are not system programming right? Being a scientific Python backbone is one of them for example. My claim was that it is nothing out-of-ordinary. In fact, I really dislike the article's somewhat evangelist attempt to target newbies. These so-called benefits existed and do exist in so many other languages. The only thing that Rust comes with is memory safety which on cl…

"My claim was that it is nothing out-of-ordinary". Well I guess will agree to disagree there are pretty prominent cases of very capable people trying to do a project in C++ and failing and then leveraging Rust and actually delivering.

And it would be great to read about such projects. But I have not heard about such. Maybe I would change my opinion.

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

#233
post #217
post #149

Earlier quoted context omitted.

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.

If you prefer languages with more features, then simple languages aren't for you. But me? If you told me you'd give me language X but with far fewer features, my eyes would light up, and I'd only ask, are you sure you can't get rid of any more? As Saint-Exupery said, "Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." Zig has all you need to write clear, effic…

As far as I can tell Zig only has C-like malloc/free-based allocation and thus is vulnerable to use-after-free, and so does NOT help you write safe code.

It also doesn't seem capable of safe concurrency.

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

#234
post #230
post #229

Earlier quoted context omitted.

> If you run tests on a Zig program out of the box you won't have array overflows; that's not what you get in C and C++. Build a C program in the right mode (also required for Zig) and you get exactly the same thing.

What mode would that be? The various fsanitize options? C doesn't have slices. Zig also allows turning on safety on a scope level. Not to mention the powerful comptime polymorphism/introspection mechanism that allows working in a more typesafe manner than C, while still being much simpler than Rust.

I don't see how Zig comptime is any simpler than Rust. Frankly, it seems more of a kluge. But we've already been over this before. :)

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

#235
post #234
post #230

Earlier quoted context omitted.

What mode would that be? The various fsanitize options? C doesn't have slices. Zig also allows turning on safety on a scope level. Not to mention the powerful comptime polymorphism/introspection mechanism that allows working in a more typesafe manner than C, while still being much simpler than Rust.

I don't see how Zig comptime is any simpler than Rust. Frankly, it seems more of a kluge. But we've already been over this before. :)

A single construct does the work, or most of the work, of generics, value generics, const fn, traits, attributes (although I expect some form of attributes might be added to Zig) and macros, and it does so without type-level programming or macro-level programming, both their own mini-languages. A kludge is in the eye of the beholder, but one is simpler than five or six.

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

#236
post #233
post #217

Earlier quoted context omitted.

If you prefer languages with more features, then simple languages aren't for you. But me? If you told me you'd give me language X but with far fewer features, my eyes would light up, and I'd only ask, are you sure you can't get rid of any more? As Saint-Exupery said, "Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." Zig has all you need to write clear, effic…

As far as I can tell Zig only has C-like malloc/free-based allocation and thus is vulnerable to use-after-free, and so does NOT help you write safe code. It also doesn't seem capable of safe concurrency.

You assume that the only way a language can help you write safe code is by making sound guarantees; this is wrong. A language can also help you write safe code by making it easy to selectively add runtime checks (that can then be selectively turned off in production), by making code-build-test cycles faster, and by making it easy to inspect what the code does. This approach has tradeoffs: it is unsound so it will let some undefined behavior bugs through; on the other hand it might do more to reduce bugs that are unrelated to undefined behavior.

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

#237

Earlier quoted context omitted.

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…

> 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?

Were you there when Haskell was new to the mainstream? For a few years there seemed to be nothing else on proggit.

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

#238
post #15

Earlier quoted context omitted.

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?

I believe he means that certain things that would need static analysis in other languages are impossible to do as part of the type system. For example match statements need to be exhaustive. Your program won't compile unless they are.

Not Impossible, but have to explicitly makred as "unsafe"

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

#239
post #38
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 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…

> it is also not necessarily the best way to reduce bugs

I think this needs to be more specific. Comparing Rust and C, for instance, it seems complexity can be used to improve correctness; the tradeoff is worth it at least some of the time.

It seems to me the best example of a simple correctness-oriented language isn't Zig, it's Ada SPARK, which has been used in various life-critical software systems. [0] SPARK's advantages are due to its simplicity:

* The whole language has been defined formally (zero ambiguity)

* The language is amenable to formal verification

A monstrously complex language like C++ brings many features, but is much harder to reason about formally, and will never have a formal definition.

[0] https://en.wikipedia.org/wiki/SPARK_(programming_language)

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

#240

Earlier quoted context omitted.

> To me the Rust community seems to want to argue that everything should be rewritten in Rust I haven't seen this. At most, I've seen the push for rewriting important libraries where security is a core issue in Rust. I don't blame them. I'm tired of C/C++ being used everywhere because of performance, leading to the current-day situation of so much fundamentally unsafe code running the world.

I'm involved in a couple of github projects where we have had drive-by "hey, rewrite your project in Rust" PRs. Obviously not official or anything, but never seen anything like that for any other language.

I feel like those are actually trolls. I don't remember the last time I saw someone serious about rust doing those types of silly stunts.
Post reply on HN