Electric Josh

Thursday, March 07, 2002

Zope was doing something tricky with the HTML it generated: it was putting a <base> tag in the HTML header, which then ended up getting FTPed to the live host machine. The problem was that the base for all the URLs in the page was then set for localhost, which is wrong. After a couple hours of trying to stop Zope from doing this (and failing), I managed to fake Zope into thinking I'd already taken care of the <base> by putting in a blank one. Now we're ready to start exporting. It has finally become easy enough for me to bother writing. We'll see what happens... #

...

Furthermore, it turns out that a BigDecimal with a value of 5 is a priori not equal to an Integer with a value of 5. Java just throws a ClassCastException when one tries to compare them. There has to be a better way. I'm not exactly doing hardcore numerics here... #

...

Update: My counterparts tell me that what I need is java.lang.Comparable. That works---so I'm happy---but why can't Numbers be comparable? The only case I can think of where this doesn't work is when the numbers in question are complex. But Java has no Complex, and even then, it seems like it could throw an exception or compare the magnitudes of the complex numbers or something reasonable and well-defined. Ah well. #

...

Working away happily and having a productive morning when I received the following error from Java:

Error: No method named "compareTo" was found in type "java/lang/Number".
That's right, Java's generic Number interface doesn't have the notion of comparisons among Numbers built in. This is why Java will eventually take the place of Pascal as the most forgotten but once-widely used and almost well-designed programming language ever. This means that I'll have to downcast a bunch of variables (i.e., hardcode the precise sort of number that I need), which is the opposite of what object-oriented languages are supposed to encourage.

Geez. #

© 2001-2002, Josh Daghlian. All rights reserved.