6 ms·
> There's almost no excuse not to use Scala if you're deploying on the JVM. Well, there are many excuses. Scala is a messy language* and I have Clojure which I
by kaoD 13y ago
> There's almost no excuse not to use Scala if you're deploying on the JVM.
Well, there are many excuses. Scala is a messy language* and I have Clojure which IMHO is a better alternative for JVM development.
I used both Scala and Clojure and settled with Clojure since it fits functional programming better. Scala is OOP with a bit of FP. Clojure if FP with OOP in case you need it desperately.
* "messy" as in "let's throw every feature we can think of into the language!"
- dinduks 13y agoScala is statically typed while Clojure is dynamically typed. Comparing them is irrelevant. > There's almost no excuse not to use Scala if you're deploying on the JVM. s/deploying on the JVM/a Java developer/
- fiatmoney 13y agoIt's a bit of a simplification to say that Clojure is dynamically typed - for instance, all of the builtin data structures conform to particular interfaces (for instance Seq) and operations over those abstractions are resolved statically. You can even make it into a parens-y Java with raw method calls, and tell it to warn you if it can't resolve a call statically (albeit you usually have to hint the initial input). There's also things like protocols, and Typed Clojure.
- chc 13y agoProtocol method references being resolved statically is just an optimization — it is not at all the same thing as a static type system like Scala has. There is no easy way in Clojure to say "This function takes an Address and a PhoneNumber" and have the compiler throw an error on compilation if Insufficiently Caffeinated You accidentally passes an integer in place of the PhoneNumber. The typed module implements a static type annotation system and type checker on top of the dynamic language, which is nice, but that still doesn't mean Clojure is statically typed.
- shadowfiend 13y agoI would take some issue with that. I think if you see the dual goal of creating a very strong, pervasive type system and trying to maintain OO compatibility, the features that are “thrown in” make a great deal of sense as a cohesive whole. It's certainly a complex language, but there is a coherent vision behind the features it has, IMO. That said, Scala certainly ain't perfect. It's certainly got its warts. And I'm not going to compare it to Clojure, as I haven't played with Clojure enough yet ;)
- cgag 13y agoI just think that dual goal is messy and not really a good goal. Can anyone comment on how possible it is to just ignore any OO stuff in Scala and just treat it like a normal statically typed functional language that happens to be on the JVM?
- pohl 13y agoWhy wouldn't you be able to? That's sort of what they're getting at when they say (if you follow the link) right under the headline: "Or anything in-between." Your discriminated unions would be "in drag" as case classes, of course. You would want to be aware of the OO parts of the language, but there's little that obligates you to use them.
- cgag 13y agoI'm not sure, I haven't looked very deeply at the language, I'm not sure if most of the libraries and culture and such make use of OO, or if it's just baggage for Java interop.
- kasey_junk 13y agoQuite easy with a couple of caveats: 1. You don't care about working with java libraries. 2. You don't care about generating tons of memory overhead. Personally, if you don't have dependencies on java and if your goal is to do a pure functional application, I would stay away from the JVM as it just wasn't built for it.
- namarkiv 13y agoComing from a haskell background, I found scala + scalaz fits all my needs. Is there a reason I should still try clojure?
- kaoD 13y ago> Is there a reason I should still try clojure? Probably not if you want to keep that Haskell background. I feel Lisp/Haskell have very different philosophies and you might not like Clojure's. OTOH, stepping out of your comfort zone is always a great way to expand your views (even if you hate Clojure at the end).
- cgag 13y agoAs a Clojure guy currently learning Haskell since I'm curious about working with a good static type system, I'm interested in why you're using Scala instead of sticking with Haskell?