Hacker News new | ask | show | jobs
by threeseed 493 days ago
I have been writing Scala and Rust everyday for the last few years.

I actually don’t see the two overlapping all that much. Rust is a terrible backend language compared to Scala/JVM. When you are dealing with real world concurrency i.e. error/thread management Rust’s memory management model becomes unusably complex very quickly. And the entire ecosystem lacks maturity i.e. the majority of libraries I use are not at version 1.

Whereas from Scala you can just use any Java library e.g. Vertx, Spring almost all of which have commercial, enterprise support and continue to be proven time and time again. It almost always just works.

Rust’s strength is in desktop apps e.g. Tauri and low-level programming.

3 comments

> When you are dealing with real world concurrency i.e. error/thread management Rust’s memory management model becomes unusably complex very quickly

I've seen this several times, but having built several highly concurrent applications in Rust, I just don't agree. Building a concurrent Rust application the wrong way is certainly complex, but if you know how Rust's strong opinions on how to structure an application work, it's downright pleasant.

Except async. Rust's async story still sucks and should be avoided as much as possible.

Compare this to Scala and it just doesn't matter about right/wrong way.

It all just works without issue. Maybe you use a few more CPU cycles garbage collecting but these days it's unnoticeable.

I'm not speaking bad of Scala or the JVM: I actually agree. When the GC and overhead don't matter, a JVM language is an absolutely fantastic choice. I was more commenting that Rust can be simple if you architect it right, that's all.

I've mostly come to the conclusion that a mediocre engineer can write performant enough Java/Scala/Clojure/Kotlin/etc. Usually even more performant than what an inexperienced/mediocre C/C++/Rust engineer could write and have an easier time doing it. However trying to ilk out the last bit of performance in a JVM language can be very challenging.

> And the entire ecosystem lacks maturity i.e. the majority of libraries I use are not at version 1.

I'm marginally bothered by the reluctance to bite the bullet and accept a 2.0 will happen in the future, but version numbers do not make for mature libraries. There are plenty of foundational libraries written in C keeping Linux desktops running that are permanent 0.x versions.

> Whereas from Scala you can just use any Java library e.g. Vertx, Spring almost all of which have commercial, enterprise support and continue to be proven time and time again.

I find that "wide and storied library ecosystem" can be a double edged sword: an old library can either be battle-tested, or just old (with cruft or poor design or implementation) and you can't always tell which it is ahead of time. This is true for libraries in any language, and the same thing will happen to Rust in 10 years.

> but version numbers do not make for mature libraries

No but they do symbolise a belief amongst the library maintainers that it isn't stable. And so I end up spending an inordinate amount of time refactoring for the latest version.

> and the same thing will happen to Rust in 10 years

From what I've seen in the last year it won't. Most of the libraries I use have stopped being maintained. The reason Java does so well here is because in enterprise space supporting something for decades is common.

I double that. Rust is great language, and I like it a lot. But usually I pick Scala whenever I can, it’s perfectly suited for complex domain.

So my rule of thumb is: Large enterprise monolithic projects - Scala. Microservises, serverless functions, systems where resources have hard constraints, cli apps - Rust.

Both are great languages.