3 ms·
Don't forget that Java already has anonymous classes, which can be used to mimic closures. I taught my advanced compilers class how to compile Scheme directly
by fadmmatt 17y ago
Don't forget that Java already has anonymous classes, which can be used to mimic closures.
I taught my advanced compilers class how to compile Scheme directly to Java by using them to implement lambda:
http://matt.might.net/articles/compiling-to-java/ http://matt.might.net/articles/compiling-to-java/
In fact, as the link above points out, anonymous classes are flexible enough to express the Y combinator, allowing "recursion-less recursion" in Java.
- statictype 17y agoWhile technically correct, using anonymous inner classes makes code more verbose. Closures are a more elegant solution. If you look at it that way, anything from generators to continuations can be 'simulated' using enough layers of class definitions.
- trapper 17y agohttp://code.google.com/p/lambda4jdt/ http://code.google.com/p/lambda4jdt/