Hacker News new | ask | show | jobs
by Kelet 4342 days ago
I'm fairly new to the language, as it hasn't been mentioned much since it's public release several years ago. The language takes many queues from Ruby; for example, "enhancements" are similar to monkey patching in Ruby. The syntax, semantics, and standard library (especially in collections) are also familiar.

e.g.:

Ruby

[1, 2, 3].map { |x| 2 * x }

Gosu

{1, 2, 3}.map (\x -> 2 * x)

Unlike Ruby, Gosu provides a static type system which includes type inference and structural typing (similar to Go's interfaces). It also includes an open type system (http://devblog.guidewire.com/2010/11/18/gosus-secret-sauce-t...), which allows first-class representations of user created types at compile time – no code generation is needed. F# programmers would find many similarities between Gosu's open type system and F#'s type providers.

Like most JVM languages, you can leverage Java compatibility to use all of the third-party libraries you want. Compared to Scala, Gosu tends to eschew complexity for simplicity and pragmatism. Their implementation of generics is a good example of this.

And of course, Gosu just has a lot of features that make it enjoyable to work with. Such as the null-safe invocation operator (?.), elvis operator (?:), type variable reification, terse syntax, etc.

2 comments

I'm sorry... My only thought is "yet another JVM language that I won't ever get to use". Because if I have a project that is new, I'm using Ruby until I need a clojure/go back-end or something. If I have an old project in java, I doubt I'll adopt a new language. Hell it's already hard enough to get people to use Scala, and it has tons of benefits over vanilla Java.

Clojure, Scala, Klotlin, Groovy, JRuby, and now Gosu... I don't know... I'd love to at least see these sites compare themselves to other languages. Like why Gosu vs Klotlin when Klotlin was already worked on by JetBrains and afaik used for the development of their IDEs...

Yeah, the JVM alternative language space is pretty crowded. Gosu does have a few advantages, though.

One big one is that it is in commercial use at many of the largest companies in the world thanks to its Guidewire heritage. That means that it is going to be continually developed and that its success isn't dependent on immediate uptake.

Another is that most other alternative JVM languages are either dynamic or more complicated than Java, whereas Gosu is still statically typed but is (arguably) simpler than Java in many ways.

But, yes, it's a crowded space and I can understand skepticism.

> Clojure, Scala, Klotlin, Groovy, JRuby, and now Gosu

Gosu is older than those others, except JRuby. That should be Kotlin without an L. And you left out Jython, and Ceylon from JBoss. The recent Nashorn from Oracle will probably take over from Rhino, which you also omitted, and maybe from one or two other JVM languages. Then there's Beanshell, the original "inspiration" for Groovy.

s/queues/cues/