4 ms·
I tend to agree most of the post apart from "1. I think Clojure is much simpler". I am not saying that Scala is simpler, just that its a matter of preference.
by prog 16y ago
I tend to agree most of the post apart from "1. I think Clojure is much simpler". I am not saying that Scala is simpler, just that its a matter of preference.
After spending a fair amount of time using both languages (5-6 months each) IMO opinion it boiled down to what style is more suited for a specific project. dynamic + lispy or static + multi-paradigm.
One feature of clojure that I did miss in my scala project was macros. The reason I picked scala for the project was that I wanted static typing for the project.
Both languages are really neat and I would rather be using one of them instead of java.
- francoisdevlin 16y agoWhat prompted you to want static typing? What did it help you do better?
- prog 16y agoThat particular project (simulation) required a lot of bit twiddling and working with data of various sizes 8-bit, 16-bit, 32-bit. So having the specific types nailed at compile time helped. Lack of unsigned data on the JVM was a pain though. Two other reasons I picked scala for that particular project was OO support and mutability. The problem fit OO better and performance was very important (I was anyway taking a bit of a hit choosing JVM over C), so with scala I had the option of for e.g. setting up a C like while loop with a counter rather than mapping a function. This was maybe 6-8 months back. Since then clojure has added neat concepts like transients[1] which allowing mutability in a controlled manner within a function. So thats worth a look. I just preferred to go for a multi-paradigm language rather than a semi-pure functional language as I wasn't sure how the project needs would evolve. What I would have really liked to do was use Python. I actually created an early prototype but the performance didn't meet the needs. I look forward to unladen-swallow :) Python did have some neat libs like struct[2] that would have worked. IMO the choice of static or dynamic should be decided by the problem at hand. I feel dynamic tends to work for majority of projects so thats what I usually prefer but sometimes static works best. [1] http://clojure.org/transients http://clojure.org/transients [2] http://docs.python.org/py3k/library/struct.html#module-struct http://docs.python.org/py3k/library/struct.html#module-struc...
- hga 16y agoHmmm ... while mainline Lisp has traditionally been multi-paradigm I don't think you can say that of Clojure, which I think is much closer to being purely functional than a lot of other "functional" languages (but I could well be wrong, I don't really know the others). Clojure at least gives you some absolute guarantees about the immutability of its core data structures. "Much simpler" could well be an exaggeration. I just multiplied my knowledge of Scala by N by looking at its Wikipedia entry and I didn't get that impression. To the extent you can avoid OO while writing idiomatic Scala there's no need for the latter to introduce a lot of accidental complexity. (I've not explored Scala not because of anything having to do with it but because I'm very dedicated to Lisp.)
- swannodette 16y ago> "1. I think Clojure is much simpler" Scala is now 170,000+ lines of code. Clojure on the other hand is about ~30,000 lines of Java and 4,000 lines of Clojure. Scala brings a very sophisticated and robust type system. This has it's benefits but it also seems to inject a considerable amount of of complexity. I haven't experienced Scala's type system so I won't venture further than that. If somebody asked me where the complexity was in Clojure I would answer thus: 1. Understanding the roles of the various concurrency primitives 2. Making idiomatic Clojure fast w/o resorting to mutable Java 3. Macros (if you haven't written them before) Besides these three areas, Clojure is mind-blowingly and beautifully simple. I've found it to be as "conceptually" small as C or JavaScript while adding an incredible amount of expressive power. EDIT: I have no actual opinion about Scala. It looks like great technology.