Golo
— a lightweight dynamic language for the JVM.

back to the front page

 Now available: Golo 0-preview10

Just in time for the end of year festivities, we are glad to announce the release of Golo 0-preview10!

We made good progress since the previous release in November. We have also been joined by three new contributors: Guillaume Grossetie, Jeff Maury (the man behind the Golo Eclipse tooling) and Kel Cecil.

You can download a Golo 0-preview10 now which contains the following noteworthy changes.

Goodies

Project creation: golo new

The golo command-line tool can now create a project for you using the new sub-command. It supports the creation of free-form, Maven and Gradle projects.

Documentation generation: golo doc

golo new is not the sole new golo subcommand, as doc can now process Golo source files and render documentation.

Documentation is written in Markdown between ---- blocks, as in:

----
This is a *nice* module that does a bunch of useless things.

See more at [our website](http://www.typeunsafe.org).
----
module Hello

----
Adds 2 elements, which is quite surprising given the name.

* `x` is the first argument,
* `y` is the second argument.

The following snipped prints `3`:

    let result = adder(1, 2)
    println(result)

Impressive!
----
function adder = |x, y| -> x + y

Documentation applies to module, functions, structs and augmentation elements.

The output is either HTML or Markdown files. The doc subcommand can be used as in:

golo doc --output target/documentation src/**/*.golo

You can see an example output on our golodoc

Bash and ZSH completion

Our new contributor Kel Cecil brought Bash completion to Golo. Daniel then brought his ZSH expertise to leverage the ZSH Bash completion compatibility layer.

Yes, that’s two shell completions for the price of a single one.

Vanilla Golo script

The golo script comes with default JVM tuning. While appropriate for most server and desktop environments, the settings are not correct for certain classes of devices such as the Raspberry Pi.

The new vanilla-golo script comes with no specific tuning but the local JVM defaults.

Inside Golo

Direct closure conversion

Previous versions of Golo provided the ability to convert closures to instances of single-method interfaces, as in:

local function listener = |handler| -> asInterfaceInstance(ActionListener.class, handler)
# (...)
let button = JButton("Click me!")
button: addActionListener(listener(|event| -> println("Clicked!")))

The Golo runtime can now directly perform this type of adaptation:

# (...)
let button = JButton("Click me!")
button: addActionListener(|event| -> println("Clicked!"))

Improved bytecode for debugging

The generated bytecode has been improved with respect to debugging symbols. Especially, variable ranges are now correct.

This makes it possible to plug any Java debugger to instrument Golo code. Yes, jdb will work, just like Eclipse with the nice Golo integration provided by Jeff’s GLDT.

Immutable structs factory

Structs are mutable by default, and they can be converted to immutable instances using the frozenCopy() method.

We now provide a factory function that directly returns immutable instances. Given a struct Point, the ImmutablePoint function does just that:

module test

struct Point = { x, y }

function main = |args| {
  let p = ImmutablePoint(1, 2)
  println(p)
}

In the community

Our unstoppable Golo Developer Advocate Philippe is playing building web stacks (as usual). You can find his latest creation called m33ki on GitHub if you are interested in quickly building web applications powered by Golo, Spark, Jackson, MongoDB and Redis.

Finally, Jeff is making huge improvements to the Golo Eclipse tooling with debugger support and better error reporting. Go and test it!

Until next time…

comments powered by Disqus