19

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?

skaffman
  • 398,947
  • 96
  • 818
  • 769
chaotic3quilibrium
  • 5,661
  • 8
  • 53
  • 86

4 Answers4

27

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.

Wilfred Hughes
  • 29,846
  • 15
  • 139
  • 192
Carson Gross
  • 286
  • 2
  • 4
  • 4
    Carson, a quick comment to say that the honesty of your posts is appreciated. Way to go. – ebruchez Feb 13 '11 at 00:20
  • I especially appreciate your candor in identifying both the similarities and differences. My needs are much more in the domain of multi-threading and developing mobile phone applications. And, Scala having a future in natively compiling to the .NET CLR is of huge interest to me. Do you know if Gosu has any plans to natively compile to the .NET CLR? – chaotic3quilibrium Feb 13 '11 at 18:54
  • 2
    BTW, if you have any influence on the displaying of that marketing chart, I would strongly recommend you urge them to either remove it, or to put in some values where Gosu doesn't get a check-mark. My BS detector fired the instant I saw that Gosu was the only one with all checkmarks. I _almost_ decided to ignore Gosu entirely. Then, I figured I would see what kind of reputation it had here on SO and found only two posts with the gosu-lang tag. Hence, my posting this SO question. – chaotic3quilibrium Feb 13 '11 at 18:58
  • 1
    @chaotic3quilibrium: I don't think Gosu offers much in that area beyond what the JVM has. If you can deal with lisp, Clojure has some interesting approaches to concurrency that might help you out. There are no plans right now to port Gosu to the .NET CLR. We stick very close to the Java core classes, so it would be awkward. – Carson Gross Feb 14 '11 at 06:06
  • 4
    @chaotic3quilibrium: The language comparison chart is, like I said, a joke. I actually was the one who came up with it, and originally had a headline that said "In a completely fair and balanced comparison, here is how Gosu stacks up against other languages" Unfortunately that language became contentious because some cultures don't get sarcasm, so it was neutered, leaving only the obviously unfair and unbalanced chart, and none of the humor. The Clojure guys got pretty pissed about it, but, all in all, I still think it's funny. Especially the "Not Lisp" entry... :) – Carson Gross Feb 14 '11 at 06:09
  • 2
    Good job -- the fact that you didn't try to slam Scala lends credibility to your answer. By the way, at this point Scala developers looking at web frameworks should probably look at Play as well. In fact, it would probably pay to be familiar with the whole Typesafe stack. – AmigoNico May 23 '12 at 18:45
16

The Gosu comparison table is somewhat unfair to Scala: The transition from Java is easy (you don't have to use all of the fancy Scala stuff at the beginning), and for reified generics Scala has not a perfect, but a workable solution called Manifests. Of course categories where Scala shines are missing (pattern matching, higher kinded types...)

kiritsuku
  • 52,967
  • 18
  • 114
  • 136
Landei
  • 54,104
  • 13
  • 100
  • 195
  • 2
    I have to agree, if you only use those features of Scala that also exist in Gosu, the the transition from Java is no more difficult. I'd also argue that the `Dynamic` support coming soon in 2.9 is directly equivalent to Gosu's open types. So that just leaves Manifests, a stronger ecosystem, better support for concurrency and a tonne of extra functionality as the differentiators. – Kevin Wright Feb 12 '11 at 18:31
  • 3
    Nah, Scala's `Dynamic` feature has nothing to do with the Open Type System. The Open Type System allows you to expose non-Gosu resources in a **statically** typed manner. It can be used to _implement_ dynamic types (as well as statically checked protocols) but it's really a different feature entirely. I agree that you can use a subset of Scala to achieve something close to Gosu. You'll still have the more complicated generics system, and, if you're looking at other peoples code, you'll have to rely on their tastes. Gosu is designed to be simple and consistent. (I'm biased of course.) – Carson Gross Feb 12 '11 at 19:41
  • @Carson: I'm interested in performance metrics around Gosu in the way it makes implementation choices to express the new syntax/sematics. Are there any discussion lists and/or posts that dig more deeply into Gosu's performance profile? – chaotic3quilibrium Feb 13 '11 at 19:02
  • 1
    @chaotic3quilibrium Native gosu classes preform about the same as java classes: we generate plain old bytecode the way you would expect for method invocation, etc. Purely synthetic types, such as the XSD types, are invoked using Gosu's reflection/type system layer and, thus, are slower. I wouldn't want to call a method on a synthetic type in the inner loop of a scientific calculation, for example. But when you are wiring remote systems together and hitting the network, it doesn't really matter much. Right now, not a lot of docs around the implementation. I'd guess those are a year out. :( – Carson Gross Feb 14 '11 at 06:13
  • I disagree mostly because of syntax. Scala syntax is extremely different from that of Java because it use () for indexed access, [] for generics, variable type and name are inverted and separated by : like Pascal. Even C# syntax is more close to Java. After so many support to C-like syntax (Java, JavaScript, C#) I wonder why Scala ended with something so terribly different. I think a smarter parser could solve most of conflicts. Scala syntax is the unique single reason that makes me consider Gosu or just keeping Java for a team of 50 developers. – fernacolo Jun 17 '11 at 18:38
  • 4
    @fernacolo: Scala's syntax differences are not arbitrary, they have good reasons: The Pascal-like `name:type` order fits better with type inference. Java's array syntax was an exception, making them very different from collections. After fixing that, the `[]` were "free", and could be used as more readable alternative to `<>`, which were abused operators, anyway. But the main point is that Scala's syntax is more *consistent* than Java's, and I think this is worth the incompatibilities. You should try to get over it, it's worth the effort. – Landei Jun 19 '11 at 13:37
2

In this thread on the gosu-lang list, Carson Gross summarized it as follows:

The short answer is that Gosu is simpler than Scala (simpler generics, limited operator overloading) but a bit more firmly statically typed than, say, Groovy.

There's also this table, but it is one of those "our product is better than your product" comparisons; i.e. intrinsically biased.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0

As far as I know, Gosu is developed by Guidewire for their product-specific development and configuration of product. So all Guidewire users/ developers use Gosu for programming. That's the major reason you don't see many posts related to Gosu scripting.

Thomas
  • 5,810
  • 7
  • 40
  • 48
sai
  • 1