Now available: Golo 0-preview8
We are very pleased to introduce the eighth preview release of Golo 0!
What’s new?
Closures and variable arguments
This release contains many bug fixes when dealing with closures and variable arguments. Many thanks to Daniel Petisme for reporting corner cases in this area!
Helpers for array types
We introduced helper predefined functions for dealing with array types:
isArray(object)
: returns a boolean ifobject
is an array, andobjectArrayType()
: returnsObject[].class
, andarrayTypeOf(type)
: giventype
as ajava.lang.Class
, returns an array of typetype[]
.
Line numbers in compiled bytecode
The generated bytecode now has Golo source files line numbers. This makes stack traces easier to deal with, because you now know which line threw an exception. This also makes it easier to use a Java debugger with Golo code.
Anonymous function calls
Golo now supports a limited form of a anonymous function calls. This is mostly useful for dealing with functions that return functions.
Consider:
let f = |x| -> |y| -> |z| -> -> x + y + z
You could use intermediate references to use f
, as in:
let f1 = f(1)
let f2 = f1(2)
let f3 = f2(3)
println(f3()) # prints '6'
You can now use a more straightforward notation:
println(f(1)(2)(3)())
Note that this syntax only works following a function or method invocation, not on expressions. This means that the following is correct:
foo: bar()("baz")
while this is not:
(foo: bar())("baz")
This is a concious grammar restriction that we made. Let us just say that this is a feature, not a bug.
Misc.
You can now test if a dynamic object is frozen or not, using a isFrozen()
method. That’s a quite
fancy name, isn’t it?