3 ms·
Then you should look into Scala
by cerved 7y ago
Then you should look into Scala
- deleted 7y ago[deleted]
- klodolph 7y agoYou made that comment twice in this thread, but you haven’t said why people should look into Scala.
- cerved 7y agoIt's multi-paradigm. Want FP? Do it. Want OOP? Do it. Want both? Do it.
- tombert 7y agoScala is fine, but do you not feel that it tries to do too much sometimes? Like, I like Scala if I'm the only person writing it; I basically write Haskell while still having access to all of Java's libraries, but I absolutely dread having to collaborate with people using Scala. A coworker of mine (whom I respect very much) said it pretty well once: "I write Scala...but in a Java accent"...he doesn't use the functional features of the language, and basically just writes Java without semicolons. When we try and collaborate on stuff, it becomes difficult because of the sometimes-conflicting way we write code. Personally, for functional-on-the-JVM, I prefer Clojure. You still have access to all the Java libraries, but it's a bit more decisive on what it wants to be: a functional, dynamic lisp on the JVM. While you can write OOP-style code in Clojure using records and protocols, it's often frowned upon, and not always 100% intuitive....virtually every tutorial you'll find on Clojure writes in a pure-ish functional style.
- cerved 7y agoIt was in response to the parent lacking OOP in FP. I think this is a problem with any language that supports multiple paradigms and ways to skin a cat. Enforcing guidelines is a way to combat that. Ofc you might also just opt for a more specific language
- tombert 7y agoThe problem with coding guidelines is that they actually are really difficult to enforce, especially during crunch-times. To quote Carmack, if the compiler allows something, it will end up in the codebase at some point. Of course, this is also true of Clojure; people will make use of bad JVM libraries because they're available if you follow this logic, F# can do unsafe mutables, and even a more pure language like Haskell allows binding into C. The difference in how idiomatic and easy it is to do a bad thing. For Clojure, the language has the "right" versions of the main data structures as first-class syntax, making it unlikely that you'd call into a Java library until needed, in which case hopefully you're using the correct one; while calling into Java isn't difficult, it is made explicit, and it does feel a bit unnatural as a result. Since Scala attaches no syntactical stigma to using the "bad" Java conventions, it's common for people to do things in a bad way (e.g. using `var` everywhere instead of `val`).