transparent lambda

tronicek at tronicek at
Thu Dec 31 00:21:08 PST 2009

Neal Gafter napsal(a):
>> My question was about how can a program differentiate multiple
>> invocations of a method from the same call site? Does it maintain a
>> counter?
> The javac compiler can use any technique suitable for implementing
> these semantics.  A counter would work if there were some way to avoid
> having to worry about the value wrapping.

Just to be sure I know what you are talking about: do you mean overflow?

Another question, which was already here, is, whether such escape of
closure would be allowed. If invocation of #() { return 2; } is always
error after returning from the first four(), it would be better to forbid
such escape.

> static #int() two = null;
> static synchronized int four() {
>   if (two == null) two = #() { return 2; };
>   return two() + two();
> }
> public static void main(String[] args) {
>   System.out.println(four());
> }

Zdenek Tronicek
FIT CTU in Prague

More information about the closures-dev mailing list