Search code examples
javascalagosu

What's the essential similarities and differences between Scala and Gosu (related to Java)?


I am studying Scala right now, and have been doing so for the last month. Today, (via Twitter) I stumbled upon another language that seems to be quite similar, Gosu.

What are the essential similarities and differences between Scala and Gosu with respect to their most influential parent, Java? Are there any web-sites that compare and contrast these two languages?


Solution

  • Yeah, our language comparison chart is largely a joke. Especially the "Not Lisp" row. :)

    As Stephen C pointed out from my original post, in general, Gosu is simpler than Scala, while Scala has more advanced features than Gosu.

    Scala and Gosu have many similarities:

    • Both are statically typed, but use type inference to reduce code bloat

    • Both support closures and more functional-style programming

    • Both provide additional functionality on top of the existing java libraries, especially around collections.

    And here are some differences:

    • Gosu does not support general operator overloading

    • Gosu does not provide syntactic support for Monads

    • Generics in Gosu are simpler than in Java (at the cost of correctness) where they are more (or at least as) complicated in Scala (although Scala does a much better job with correctness.)

    • Gosu does not support things like Scala's implicit '_' argument in closures: it is more explicit in cases like this.

    • Gosu's extensions to the core Java libraries are less dramatic. We weld additional methods onto existing java types, rather than introducing a new type hierarchy.

    There is one big difference between Gosu and Scala on the functionality side: Gosu has what we call an Open Type System. This allows people to plug in arbitrary resources to the Gosu compiler. As as an example: Gosu (as of 0.8.5) supports XSD and WSDL files as first class citizens:

    http://lazygosu.org/xml.html

    The Open Type System is, on the functionality side, the real differentiator between Gosu and other statically typed JVM languages.

    All that being said, the unfortunate reality right now is that Scala is much more mature than Gosu in some areas, especially tooling. There is great IDE support for Scala in all of the major IDEs. We have an Eclipse plugin for Gosu, but it is still in its infancy. Similarly our IntelliJ plugin is very new.

    Scala has a very complete web framework, Lift. I'm not a huge fan of their approach, but it is complete and a lot of people like it.

    Gosu has a web framework as well:

    http://ronin-web.org

    I love Ronin's approach, but then I would, wouldn't I? Ronin is being built by guys who know Gosu very well and, thus, it leverages a lot of functionality in the language.

    Hope that helps. Realistically, if I were starting a project today, I'd probably go with Scala just because of the tool support. However, if you want to strike out in another direction, particularly if your project involves web services or XSD handling, Gosu might be a rewarding language to use. In the long run I hope that Gosu will be the pragmatic choice for JVM developers, but only time will tell.