BCEL. A tool to build classes on the fly and output them as bytecode. Complex stuff. Luckily it comes with BCELifier. This tool can take an existing .class file and generate the BCEL java source code to build that class. Very cool.
What this means is that if (like me) you find BCEL itself a mite tricky, you can write your class in the normal way, compile it, BCELify it and end up with the source code you need to feed BCEL with to get the same result. Groovy. This reminds me of my dim past, recording VBA macros in Excel to find out how to do something, then hacking the generated code into what I wanted. [Pushing the envelope]
I’m really not sure how I feel about this. We are really re-treading the boards that lisp trod with it’s macro system many moons ago. I suppose the complexity of our solutions is the result of refusing to swallow the lisp/scheme mantra of code and data being one.[Brett Morgan’s
Indeed. I’m still looking for the ‘perfect’ language. Java with closures, multiple inheritance, dynamic execution (like Perl’s ‘eval’) and primitives as first-class objects (a la Smalltalk) would be pretty cool.
This article on an imaginary ‘Java 3’ also makes for an interesting read.