golo-lang/golo-lang — pull request #194 by yloiseau (2014-10-23 12:27:14+00:00)
Title: Named augmentations

This PR adds a new syntax for augmenations allowing to give them a name, and thus to be reused in the module scope to augment classes or structs.
This can be seen as a kind of lightweight traits.

As an example:
```golo
module TestNamedAugmentations

augmentation testNamedAugmentation = {
function foo = |this| -> "foo"
function bar = |this, a| -> this: length() + a
}

augmentation otherNamedAugmentation = {
function spam = |this| -> "spam"
}

augment java.lang.String with testNamedAugmentation, otherNamedAugmentation

augment java.lang.String {
function baz = |this| -> "baz"
}

function main = |args| {
let mystring = "hello"
require(mystring: foo() == "foo", "foo failed")
require(mystring: bar(4) == 9, "bar failed")
require(mystring: spam() == "spam", "spam failed")
require(mystring: baz() == "baz", "baz failed")
}
```