3 ms·
To anyone deciding between Scala and Clojure: If you want a simple and concise syntax, hate long compile times, don't mind polish notation, want purer function
by eranation 13y ago
To anyone deciding between Scala and Clojure:
If you want a simple and concise syntax, hate long compile times, don't mind polish notation, want purer functional programming, don't need an IDE, and prefer dynamic typing, Clojure might be your cup of tea.
If you like using an IDE, autocompletion, refactoring and almost 1:1 Java interoperability, want a statically typed language with both functional programming and OO and still be able to do things you can't do in Java (like duck typing, "pimp my library", and dynamic method names), need a language that has high adoption chances in both Startups and Enterprise Java shops - and don't mind LONG COMPILATION TIMES, (and fine with never really fully understanding CanBuildFrom) Scala might be your better choice.
If you didn't choose Scala ONLY because of long compilation times, make sure to give Kotlin a look.
If you didn't choose Clojure because it's dynamically typed or because (not (like you polish_notation)) then try Haskell
- profquail 13y agoClojure has core.contracts now, which can be used to get some of the same correctness guarantees you can get from a strong type system. https://github.com/clojure/core.contracts https://github.com/clojure/core.contracts
- stewbrew 13y agoJust for the records: strong != static typing && Runtime contracts != compile.time type checking
- danneu 13y agoAlso, there's https://github.com/clojure/core.typed https://github.com/clojure/core.typed. I don't have much experience with static typing outside of basic Java interop, but I gave it a shot on a recent project and it was pretty cool once I got the ball rolling and it caught my first actual bug.
- stewbrew 13y agoYes (though I find it painfully slow) and there is more but making use of those would most often require you to duplicate type information.
- wging 13y agoClojure's Java interop seems good to me. Why is Scala's a distinguishing factor?
- asdasf 13y agoNot that you need to fit into everything in either list. For example, I strongly prefer static typing (haskell guy) and I still prefer clojure over scala.
- jnfrd 13y ago1) if you don't write your own collection you don't need CanBuildFrom 2) What is so hard to understand about CanBuildFrom[-From, -Elem, +To]. It's an object that will return a builder for a collection: See http://www.dotkam.com/2012/05/08/scala-fun-with-canbuildfrom/ http://www.dotkam.com/2012/05/08/scala-fun-with-canbuildfrom... for an explanation. In Java one would call it a Factory ;-)
- mattdeboard 13y agoI'm not an IDE hater, I really enjoy IntelliJ, but there are capable plugins for Clojure out there. Emacs has autocompletion. I don't know what "1:1 Java interoperability" means but the only thing I know of in Java that really doesn't play nice with Clojure is annotations. (Not to suggest there aren't others) Shrug, I've used Scala and Clojure both (more the latter than the former). Both are pretty cool and have a lot going for them. Both have downsides (though in full disclosure I think Clojure is much better at making up for its downsides)The real choice there is: Do you want static typing -- and all that implies -- or not?