Extending Java with Yield

Yielder library is a library that uses Java 1.5's facility to hook user-defined class

Extending Java with Yield

Extending Java with Yield

     

  
Yielder library is a library that uses Java 1.5's facility to hook user-defined class inspectors/transformers into the classloader and rewrites the byte code of a yieldNextCore() method containing calls to yieldReturn(foo) in order to prompt the local variables to members of an anonymous inner class. This inner class is also collections library built on top of Yielder, with tree traversal iterators and map/filter-like functionality that maintains the state of the iterator/generator.

From the programming point of view, the ability of hooking into the classloader and do byte code manipulation on plain java classes enables us an interesting mechanism for prototyping new language features in libraries.