Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

scala

gosu

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?

like image 829
chaotic3quilibrium Avatar asked Feb 12 '11 00:02

chaotic3quilibrium


People also ask

What is difference between Scala and Java?

Scala is a mixture of both object oriented and functional programming. Java is a general purpose object oriented language. Scala is less readable due to nested code. Java is more readable.

How is Scala similar to Java?

Similarities between Scala and Java 1) Both are JVM based language, Scala produces same byte code as Java and runs on Java Virtual Machine. Similar to Java compiler javac, Scala has a compiler scalac, which compiles Scala code into byte code.

What language is most similar to Scala?

Kotlin, Python, Clojure, Java, and Golang are the most popular alternatives and competitors to Scala.

What are the advantages of Scala over Java?

The Advantages of ScalaScala has an exact syntax, eliminating boilerplate code. Programs written in Scala require less code than similar programs written in Java. It is both an object-oriented language and a functional language. This combination makes Scala the right choice for web development.


1 Answers

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.

like image 146
Carson Gross Avatar answered Sep 17 '22 15:09

Carson Gross