It’s Wednesday, so there must be another new scripting language for the JVM.
Well, the latest entry in this crowded field is Gosu, a language that feels a bit like Groovy, but with Scala-like static typing. It attempts to plug some of the perceived holes in current JVM scripting languages (static typing) and Java itself (type inference, closures, properties, delegates, etc.). Gosu compiles to Java classes and enables good code completion and strong compile-time verification.
If you have Java 1.5 or higher installed (who doesn’t?), it’s very quick and easy to give Gosu a try. Just download and unzip, and the gosu command line and editor environment are ready to go. There’s an Eclipse plug-in, but since it doesn’t yet support the newer Helios (3.6) version I have installed, I skipped it for now.
If you’re like me, your eyes may roll when someone actually promotes static typing. But Gosu’s type inferencing goes a long way to simplify code and make it feel a bit like dynamic typing. Likewise, many other features (properties, short hand syntax, cleanups, etc.) are mainly directed toward simplifying code and reducing bloat, alleviating Java’s “endless forms in triplicate” feeling.
Just to get a feel, I coded a few small things in it, including a solution to this week’s Friday Fragment. For just about everything I tried, it was quick, clean, and intuitive, although error messages were sometimes confusing.
Gosu’s inventors (Guidewire Software) and others have already made good use of the language in production systems, so it’s not some fly-by-night research project or half-baked alpha that’ll likely go away or get neglected. But it’s not yet clear how much adoption it will see. I really like the language, but I’ll probably take a “go-su? we’ll see” approach before using it further.