8 ms·
For the OP - i've recently been programming in Scala, mostly spark jobs, nothing too complex, but damn its beautiful. I love how expressive the language is (cer
by bonobo3000 11y ago
For the OP - i've recently been programming in Scala, mostly spark jobs, nothing too complex, but damn its beautiful. I love how expressive the language is (certainly it can also be very complicated in large codebases, as you use more features, but I haven't encountered that yet). Heck just the simple 'scala' repl + JVM interop makes developing Java code so much easier. You seem to have tried Scala too - i'm wondering what you think of Clojure vs. Scala and what made you switch?
- bad_user 11y agoI've been a Scala developer for the last 3 years and I'm in the camp that first played with Clojure and then switched to Scala. I'm still playing with Clojure from time to time, but I like Scala more. The only difference one should care about is static typing versus dynamic typing and that's it. Of course it's not a binary black and white classification when looking at languages, for example Scala is less static than Haskell and Clojure is less dynamic than Ruby. But overall that's the biggest difference and that changes the style, the mentality you have, how the code looks like. As an example you are much more likely to see in Scala the Maybe/Option monad, whereas in Clojure people prefer to work with null (nil). Rich Hickey said it himself that Option[T] only makes sense in a static language. In general in Scala you're more likely to see things like monads and functors being modeled explicitly. It's more natural to do that in Scala because it's all a matter of describing functions with certain signatures. And you know, when working with combinations of flatMap and map, it's much easier if you have the compiler telling you where you've fucked up. Which is why many people do use things like Scalaz or Cats or Shapeless. On the other hand in Clojure it's much easier to build things like transducers, because there's no type-system to stay in your way. Clojure people work with lots of DSLs built over macros. You can see that in how Clojure exposes those channels in core.async and compare that to how asynchronous processing of events is done in Scala (e.g. Future, Iteratees, scalaz-stream, Rx, Akka actors, Reactive Streams, shameless plug: https://github.com/monifu/monifu https://github.com/monifu/monifu). Of course, Scala has its own macros system, but like in other static languages, the macros in Scala are only being used by those that really know what they are doing. But because of that, in both languages you get features exposed as libraries instead of being special language features. For example here's Scala's equivalent for C#'s await/async exposed as a library: https://github.com/scala/async https://github.com/scala/async Which one is better is actually dependent on the problems you're trying to solve. The problems I'm working on have a very complex business logic and are a better mix for static typing. This is why people will never agree on which one is better, because it actually depends on context.
- sklogic 11y agoScala got no macros. Which makes it infinitely less powerful than any language with macros, including even something like Clojure.
- bonobo3000 11y agoSimilarly, Clojure got no types. Which makes it infinitely less runtime-safe then any language with types. Takes a more nuanced argument.
- sklogic 11y agoFor a language with macros it does not matter at all. You can add any type system you like on top of it. Metalanguages are infinitely flexible.
- justthistime_ 11y agoThe strength of a type system is that there is one. If everyone uses his/her own self-made pet of a typesystem most of the benefits are gone as soon as you are more than a one-man-hobbyist project. Probably explains why most Lisps consist of one-man-hobbyist projects, though.
- sklogic 11y ago> The strength of a type system is that there is one. I do not agree. There is no single type system that would fit all the possible use cases. > Probably explains why most Lisps consist of one-man-hobbyist projects, though. No, it does not.
- justthistime_ 11y agoType systems are by-definition only a conservative approximation of all programs. The good thing is that 99.999999999999% of all programs never need to be written, and there are plenty of type systems which deal well with the last 0.00000000001. > No, it does not. Ok, that leaves the failure of Lisp outside of hobbyist mom's basements a mystery.