golo-lang/golo-lang — pull request #190 by Artpej (2014-10-10 17:08:19+00:00)
Title: Change the original function arity with decorators

It is not currently possible to change the
the arity of a decorated function.
( see https://gist.github.com/yloiseau/d669c0e30023bf5b5bbc )

Originaly the function `foo`:

```golo
module curry

function curry = |f| -> |a| -> |b| -> f(a, b)

@curry
function foo = |a,b| -> a + b

```

is converted to :

```golo
module curry

function curry = |f| -> |a| -> |b| -> f(a, b)

function foo = |a,b| -> ^curry( |a, b| -> a + b )(a, b)
```

The trick tranforms the original function in a
variable arity function like this :

```golo
module curry

function curry = |f| -> |a| -> |b| -> f(a, b)

function foo = |args...| -> ^curry( |a, b| -> a + b ): invokeWithArguments(args)
```