You can hook code to the Java compiler

I had no idea you can plug into javac to do nifty things like adding roman numerals to your java code:

public class Example {
    public static void main(String[] args) {
        System.out.println(
            MCMLXXVII + XXIV
        );
    }
}

You can also do string interpolation, so php-like things like:

String name="john";
int age=12;
System.out.println("name=${name}, age='${age}'");

are also possible.

I don’t think the average java programmer needs this kind of power, but I must admit it is great for experimenting language functionalities.

I’m not into Java any longer, but it would be great to hack an extension so numbers are arrays of length 1.


About this entry