Live data from Hacker News

What is Rust and why is it so popular?

stackoverflow.blog

181–190 of 284 posts

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

#181
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…

> 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.electronicdesign.com/technologies/dev-tools/arti...

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

#182

Earlier quoted context omitted.

I don't think it's fair to say that Rust is entirely academic. It has a lot of production users including some very large names: https://www.rust-lang.org/production/users

I didn't say that Rust was entirely academic, I said most uses of Rust were academic.

You have any stats to back this up?

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

#183

Earlier quoted context omitted.

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

Julia lost its momentum, and for good reasons: insuficient or rushed up libraries, no option for the generation of standalone executables and general overselling (by the way, bashing Python at every opportunity didn't lead to a higher volume of users)

It didn't lose momentum.

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

#184

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 find it comforting that the Rust community is casting a wide net, even if it’s not always the best fit. It’s something I always enjoy about working with Python.

There are some platforms and ecosystems that pour 90% of the effort into a handful of popular niches, but once you leave that comfort zone you’re on your own. Elixir can feel like that; Ruby/Rails too back in the day.

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

#185
post #135

Earlier quoted context omitted.

> If you're doing anything higher level than kernel programming, Rust is just as viable as anything else I don't think so because it suffers from the same limitation that all low-level languages have, which is that API clients need to be aware of implementation details. Rust sometimes makes that propagation of leaked information automatically via the type system, but internal implementation details -- how allocated m…

That's not a limitation of "low-level languages", it's inherent in low-level API's . These two are not the same. You could have a Rust program that interfaces with outside systems only via protobufs over a network socket, or what have you, and it will work just fine. Same for just about any "high-level API" format you could think of. Of course, using such high-level formats comes at an efficiency cost since you have…

The program itself is made of components that expose a low-level API, or otherwise you wouldn't use a low-level language. The API clients are other parts of your program. Programs written in low-level languages are much more tightly coupled than languages that support better abstraction (for the price of less control).

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

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

    fn add2(x: i32, y: i32) -> i32 {
        x + y
    }
variable declaration is varname: type, it makes it very hard to read when declaring arrays or other things

return type is after the paren

the let keyword seems redundant/unnecessary, a little like var in js

Those are good example of "c flavor". I guess they're easier to parse, but still I would rather have C flavor instead.

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

#187
post #157
post #111

Earlier quoted context omitted.

You've been asserting this for a while now, without really describing what you mean by "Zig's approach." What features are you thinking of here, and why would we expect them do any better than existing tools in C++ (or even C)? For example, "modern C++" is also often described as having similar benefits to safety.

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. Rust's language complexity is dedicated to things that Zig simply doesn't check, and that C and C++ have checked only recently.

This goes back to a previous conversation of ours[1]- Rust's complexity is allocated very differently than C++'s. It has many of the same advantages as Zig (if not more) when it comes to understanding and code review. 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.

[1]: https://www.reddit.com/r/programming/comments/eehe6t/a_backw...

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

#188

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?

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 90% of the way there without forcing all the architectural dances Haskell does. Just my opinion.

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

#189
post #168

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…

sorry for the tangent, but what has Go turned into in your opinion? (I'd believe it fits quite well your definition)

It seems to have remained pretty much exactly as it arrived.

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

#190
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, so what? Python is not as fast as Scala, so.

Control over low-level details is something that exists and should be in any system-programming language. How is that even a benefit? It is a niche feature.

Memory safety? You can circumvent it by using "unsafe" and as recent Actix case shows it can propagate really deep. Should I read the code of any other Rust library now? What if I am a programmer newbie driven by the hype without a clue what does memory safety entail? What-ifs... I won't talk about compile times and the fact that in order to compile some cli tool one has to download ~200mb of rust "stuff". This is simply insane and I refuse to understand how is this considered to be not an issue.

Rust ecosystem is probably its strongest point right now which is somewhat funny because it grew out of beliefs in the above "benefits". So, not hyped, sorry.

Post reply on HN