User loginNavigation |
archivesExtending Java with YieldThe Yielder library by infomancers (a.k.a. Aviad Ben Dov of the Chaotic Java weblog) is a library providing Java with Ruby/Python/C#-like yield-ing for iterators. It works by using Java 1.5's facility for hooking user-defined class inspectors/transformers into the classloader, and rewriting the bytecode of a yieldNextCore() method containing calls to yieldReturn(foo) so that its local variables are promoted to members of an anonymous inner class, which also maintains the state of the iterator/generator. Examples, rationale and implementation are discussed in detail at Chaotic Java. There is also a collections library built on top of Yielder, with tree traversal iterators and map/filter-like functionality. From a PL perspective, this ability to hook into the classloader and do bytecode manipulation on plain java classes provides an interesting mechanism for prototyping new language features in libraries. It could equally well support an aspect framework (via annotations), and perhaps even something like Terracotta's distributed heap. JediJedi aims to bring a more functional style of programming to Java. It does so by providing a library of routines for filtering, iteration, conversion from one collection type to another, first order logic functions, etc. It makes extensive use of higher order functions and closures. Unlike most libraries with similar aims, Jedi tries to take the hard work out of producing the required closures by providing JDK 1.5 annotations which generates the necessary filters, commands and functors. Jedi has been used on a number of commercial applications and has been found to significantly simplify the code. By lancewalton at 2007-07-30 12:53 | LtU Forum | login or register to post comments | other blogs | 5579 reads
|
Browse archivesActive forum topics |
Recent comments
27 weeks 3 days ago
27 weeks 3 days ago
27 weeks 3 days ago
49 weeks 4 days ago
1 year 1 week ago
1 year 3 weeks ago
1 year 3 weeks ago
1 year 6 weeks ago
1 year 10 weeks ago
1 year 10 weeks ago