Hacker News new | ask | show | jobs
by jeremyjh 4956 days ago
Well, both have good support for concurrency through Actor implementations. They have a little bit similar syntax, both have a basic level of type inference. After that, pretty much everything is different about them.

There are really too many differences to consider, but some things come to mind first. I apologize for the problems in this description. At some point I may write a detailed article with examples, so any feedback on inaccuracies in this would be helpful.

Go is designed as a minimalist language. This has some benefits and drawbacks.

Scala is design as a language that is small but very extensible, making for a much larger programming system that you have to learn to use effectively.

Scala has lots of advanced language features from functional programming. Idiomatic Scala uses these features extensively. Go has closures, but not any other features for functional programming - for example it has no immutable data structures, no pattern matching, no tail optimization.

Scala has advanced features from object-oriented programming; everything is an object but basic types are compiled to JVM primitives where possible. It has traits/mixins which provides a way to implement multiple interfaces but they can also provide implementations which makes it a lot easier to provide default implementations so that a previously-written class can be declared with that Trait even though it does not know how to satisfy the interface. Go has a simplified and in some respects novel approach to OOP. It has interfaces and duck-typing which may be familiar but you really have to learn "the Go way" to understand what is happening with features like embedding which may seem to have some superficial similarity to inheritance in Java/C#.

Both provide a means to multi-plex Actors (Goroutines) onto threads. Using the Akka package with Scala provides an Actors implementation which will work with both in-process and out-of-process Actors. Google's netchan package was dropped before 1.0 and I do not know if there is any productive development being done in this direction. So to scale goroutines out of a single-process you'd need to use RPC, zmq or some other low-level socket approach.

So far, the Scala code I've looked at in different open-source projects seems fairly consistent. While the language-space seems big, I have not seen the fragmentation problems that some people may have predicted. With Go there is little chance of this, often there is only one reasonable way to do a given thing.

Go compiles to native code but the compilers are optimized for very fast compile times - the code produced is 2-3x slower than Scala in doing math-intensive benchmarks. For most apps we'd actually write, I'll bet they are pretty close. Go statically links a runtime and has garbage collection. It starts up VERY fast compared to any JVM application.