7
submitted 11 months ago by azthec@feddit.nl to c/scala@programming.dev
you are viewing a single comment's thread
view the rest of the comments
[-] silasmariner@programming.dev 3 points 10 months ago

A propos, I actually find that the biggest win of FP is somewhat orthogonal to it, and that's immutability. This leads to the ability to reason locally about code which is IMO completely invaluable even outside of parallelism scenarios. When you don't know if a method might be mutating a parameter without actually reading all the way down it's a real PITA ๐Ÿ˜… (I have been doing a lot of refactoring of a large codebase recently and this has been a serious issue)

[-] azthec@feddit.nl 1 points 9 months ago

For sure, this has been something I learned from working in Scala that has made my code in other projects much more readable and easier to reason about. For performance reasons I may need to use mutables, but often I can keep it in the context of the function and just encapsulate it.

[-] benjhm@sopuli.xyz 1 points 9 months ago

I don't do pure FP, but do value the scala concept to write immutable by default unless there's a good reason not to (usually efficiency, inner-loop stuff). While refactoring old code (most was originally java) I gradually convert vars to vals, but the old mutable code still works too, it's multi-paradigm. What matters most for reasoning is readability, scala3 really helps with this.

this post was submitted on 30 Sep 2023
7 points (88.9% liked)

Scala

329 readers
1 users here now

founded 1 year ago
MODERATORS