Closed GoogleCodeExporter closed 8 years ago
The proposed solution consists of two parts:
1. Associate local bindings with each Jaql function. Currently, a Jaql function
consists of a set of parameters with optional default value expressions and a
function body. Adding local bindings means that the function also contains
(constant)
values for the free variables in the default value expressions and the body,
which
binds those variables. For example,
z=1; fn(x=z) x;
will create a function that has a local binding "z=1". The function obtained by
evaluating the above expression decompiles to
const((z=1, fn(x=z) x))
The definition of a function literal has been extended to all Jaql expressions
that
produce a function and are compile-time computable. Thus, the expression above
constitutes a function literal.
2. Put default value expressions into the expression tree. This makes them
visible
during the compilation/rewrite process. Thus
( x=1, fn(y=x) y );
behaves as expected; x is not marked unused anymore.
Original comment by Rainer.G...@gmx.de
on 1 Oct 2009 at 10:28
Fixed in r373
Original comment by Rainer.G...@gmx.de
on 1 Oct 2009 at 10:33
Original issue reported on code.google.com by
Rainer.G...@gmx.de
on 25 Sep 2009 at 4:13