• 1 Post
  • 34 Comments
Joined 1 year ago
cake
Cake day: June 25th, 2023

help-circle












  • Rust is mainly designed to overcome common memory problems people have with low level C systems without the overhead of garbage collectors

    So you didn’t read my comment then.

    A concrete example of what my comment means is opening files. When you open a file handle, you can read from it, write to it, but then you should close it. After you close it you shouldn’t be ready to or write from it again. If you do, bad things can happen.

    Rust is the only language where you cannot. It’s a compile time error. This has nothing to do with low level systems programming. Using file handles is very high level.

    Same goes for thread safety. Web servers often can benefit from multithreading. Java does not enforce thread safety at compile time. If you send some data across threads and you don’t already understand what is thread safe and what isn’t, you’ll end up with data races, which is a form of memory safety violation. This is not possible in Rust, but it is in Java.

    Rust also isn’t subject to “the billion dollar mistake” since it doesn’t have the concept of null references. It also doesn’t support exceptions, which are the exact same issue as null references. These are also general programming problems and not specific to low level systems.

    Regarding frameworks, I’ve used Spring before and, although Rust doesn’t do some things Java frameworks do, IMO that’s a very good thing, and the web frameworks I’ve used in Rust have been a far better experience than what I saw from Spring.



  • Rust is a general purpose language which is excellent for API servers and many other things. I’d say it’s definitely a direct competitor to Java. The only difference is in the ecosystem of libraries.

    Rust’s type system is really just about enforcing correctness, which is very important in a general sense. Memory safety is just a subset of correctness.

    You can see this is in practice since there are a TON of devs like myself coming to Rust from JavaScript.