Gosu

On 5 December 2011, in Gosu, Java, Nuisances, Programming, by stacy

Deriving its name from the Korean term for a “highly skilled person,” Gosu is a computer language targeting the Java Virtual Machine.  It tries to be more expressive than Java (which isn’t really all that hard) while being conceptually simpler than Scala.  Of course, sometimes simplicity comes with other baggage.  “Type parameters are covariant. This is not sound, and that does not matter” (http://lazygosu.org/generics.html).  I’ve spent some time arguing about covariance, contravariance, and invariance, and I think it matters.

Ooh!  See this.

The real issue with Gosu, however, is documentation.  A quick search for Gosu turns up http://gosu-lang.org/.  From this you can find a quick start guide and comprehensive documentation.  Great!  I read the quick introduction and then download the distribution.  It’s nice!  It comes with a lightweight IDE and an interactive “REPL” mode.  That’s what I like to see.  Next, I dig into the comprehensive documentation… but examples from the documentation don’t work!

For instance, the documentation of DateTime (here) says:

Gosu implicitly coerces the Gosu DateTime object from String in most formats. For example:

var date : DateTime = "2007-01-02"

Nifty!  I try that and I get:

program_.__Program__0

Errors: 

The type "java.lang.String" cannot be converted to "java.util.Date" [line:1 col:23] in
line 1: var date : DateTime = "2007-01-02"
Expected Type: Date
Line Number: 1  Column: 23

That doesn’t seem like automatic coercion to me.  Never one to give up without a fight, I post the following message to the Gosu forum:

The following code:

var date : DateTime = “2007-01-02″

taken directly from the Gosu DateTime page fails to compile with the
following errors:

Errors:

The type “java.lang.String” cannot be converted to
“java.util.Date” [line:1 col:23] in
line 1: var date : DateTime = “2007-01-02″
Expected Type: Date
Line Number: 1  Column: 23

This is also true if one tries “Jan 2, 2007″ as DateTime.
So… What am I doing wrong?

$ gosu -version
0.8.6.1-C

$ javac -version
javac 1.6.0_26

$ java -version
java version “1.6.0_26″

Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

$ uname -rm
3.0.0-13-generic x86_64

Thanks in advance.

I expect something along the lines of “wrong version of Java,” or “you’re an idiot because.”  Instead, I receive this:

In the open source version of Gosu we don’t support the implicit string to
date coercion.  You’ll have to use the .toDate() method on String instead:
var date  = “2007-01-02″.toDate()
Cheers,
Carson

Okay, great.  Apparently there is an open source version of Gosu and a closed source version.  I google in vain for information on these, but none appears.  Searching the documentation for “open source” turns up nothing.  Everything I read says Gosu is released under the Apache license, and nothing seems to indicate otherwise.  So… Clearly the comprehensive documentation is either wrong or incomplete.  I’m not happy with either.

I did reply asking where the differences are documented.  I’ll post here whatever I hear back.  I’ve probably missed some obvious, glaring, probably blinking notice about the differences.

So no Gosu for us, at least for now.

Share
Tagged with:  

One Response to Gosu

  1. Carson Gross says:

    Hi Stacey,

    Thanks for looking at Gosu!

    Yes, so our documentation is a bit lacking. We are currently all hands on deck getting the intellij plugin working, since a statically typed language without a good IDE is a very poor user experience. Documentation is on the list, but realistically it probably won’t be great until the middle of next year.

    Also, another thing hindering doing Gosu development is the lack of a web framework, etc. We are working on a Rails-like (but w/ static typing) framework called Ronin (http://ronin-web.org) and, again, I’d expect that to be in a decent spot by the middle of next year.

    And I should qualify all of this by saying this is with respect to *open source* Gosu. Guidewire’s internal tools for Gosu development are quite mature and are an entirely different story (as evidenced by the big boys deployed with it.)

    I’m happy to argue about variance or talk Gosu whenever you like. And thanks again for looking at Gosu!

    Cheers,
    Carson

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">