3 ms·
I mainly program in low-level imperative languages (mostly C/C++), and occasionally dabbled in some functional languages (like Ocaml and Elm). But I don’t reall
by lasagnaphil 8y ago
I mainly program in low-level imperative languages (mostly C/C++), and occasionally dabbled in some functional languages (like Ocaml and Elm). But I don’t really understand why you would need such a convoluted system to get/mutate some values in a data structure in Scala. Doesn’t Scala allow mutability throughout its language already (unlike Haskell)?
- whateveracct 8y agoLens doesn't give you mutability. It gives you operations that look like mutations but are still operations on immutable data structures. And that is where the value lies.
- sk5t 8y agoScala, like, enables and encourages immutability, while making regular Java stuff and practices also entirely available (excepting a few Java varargs situations that perplex Scala's notion of arity). This article is, sort of, related to ideas on avoiding mutability anyway.
- papaf 8y agoBut I don’t really understand why you would need such a convoluted system to get/mutate some values in a data structure in Scala. It allows you to work with deep data structures in a safe immutable way. Scala is a nice language for working with data, the standard library, techniques such as lenses and ecosystems such as Spark all contribute to this.