Situations where Scala beats Rust

Anyone here also using Scala? If so, what are types of problems / abstractions (besides "I need JVM library") where Scala beats Rust ?

I've been playing with Scala on & off. I find Scala vs Rust to have similar IDE experiences, Scala to have somewhat more complete libraries (JVM), but really miss Rust's borrow checker. I never got deep into Scala.

For those that use both Scala & Rust, I'm curious to hear what types of problems / abstractions work really well in Scala but are difficult to express in Rust.


1 Like

Quite a long read, but has some valuable insights:


If you want the flexibility of a functional effects system, Scala does that. Rust does not.

1 Like

Hey! I was just reading through your thread that @jendrikw (what is this? shasum?) linked. I'm about 10 posts into that thread.

Funny you mentioned Cats. I tried it -- but ended up preferring the Rust borrow checker approach. Mentally, I can simulate what the borrow checker is doing; but with enough layers of abstraction, Functional programming becomes confusing to me. Especially when there are 3-4 layers of higher order functions modifying each other.

That said, I'd probably spent 20x the time in Rust as I did in Scala, so this is likely just a sign of my Scala being weak.

I'm curious if, 6 months later, you still feel the same way.

Also, what is a "functional effects system" and what are examples of problems it solves really well ?

Oh, one thing I will credit Scala with is this: ScalaJS beats rust + wasm + wasm_bindgen + web_sys + js_sys ... for JS related tasks. There's no comparison there.

Hi, sorry, I forgot to respond to this.

Agree that Cats-style pure FP is a headache. The worst part are monad transformers - that's the thing that really ruins it for me, despite the elegance.

ZIO is a functional effects system and much, much more pragmatic and practical. The big deal with these frameworks is that they separate code definition from execution. Effects are blocks of code but are pure values, and an custom runtime executes them. Because they are pure values, you can compose them and mutate them at will, which makes things like complex retries and structured concurrency really easy.

I'm not preaching it here. I took a hiatus from Rust but I lean towards Rust's overall solution being generally superior, but it really depends on the context and what you need to do.

Check out this video, esp. the dining philosophers solution around minute 39. It will probably astound you.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.