Java just keeps getting better!
December 27th, 2004 ~ Posted in: GeneralI started investigating the Java Postscript interpreter that I mentioned previously: the code is actually pretty straightforward, despite the fact that there are no comments. That is impressive: if the same code was in C, I think it would be a lot harder to follow, what with pointers and enums, structs. Of course, I’ve been helped along by Eclipse, which is very useful for keeping things in context: it has mousetips that tell you the fully qualified type of the object the mouse is hovering over, and if you click on the object, say a function, it displays the declaration of the object in a pane. Furthermore, you can browse the class hierarchy and function call trees. Eclipse would be darn near perfect— only thing is, my computer is way too slow to run a Java application as large as it, and it doesn’t seem to have any easy way to access the Java SDK documentation
Inspired by this experience, I started combing the web for interesting examples of Java in use, and discovered gJ and Pizza, which enhance Java by adding generics, which are like the templates in C++. I’m surprised Java doesn’t already implement generics, but it seems that Sun is seriously considering adding it; having generics would make it simpler to handle functions that expect arrays of arbitrary object: instead of just fname(Object [] arr), you could have something like fname(<type> [] arr), and Object [] fname() could be replaced by <type> [] fname(), which would make error checking easier, because it wouldn’t be possible to sneak in an apple into an array of oranges, for example.
I also looked up native compilation— it turns out that actual native compilation might not actually occur, just wrapping an EXE around a call to the JVM– and compilation of `assembly’ code to bytecode.

This entry was posted on Monday, December 27th, 2004 at 1:47 pm and is filed under General. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Leave a Reply