Java Musings

I've finished my first project for my CS class. Typical annoying CS busy work, but it did give me a chance to play with Java. As I've said earlier, I do like Java, but it has some annoyances:

  1. No function pointers. A callback here or there would be nice.
  2. No lexical scopes. This can be very handy, and...
  3. No closures. No lexical scopes + no pointers = no closures. Closures are incredibly useful and powerful. Yes, I know I can fake it with anonymous classes. No, that's not good enough.
  4. After 40 years of language development, it's shocking that we're still using languages with fixed arrays. We're using compilers for a reason!
  5. Constructors can't be inherited. Sometimes inheritance isn't about changing instance variables!
  6. Static. Don't use the keyword static in your language. It means 8 different things in dozens of different languages. Use a name that actually has a mnemonic.
  7. Instance/method access. This is actually a mistake that java inherited from C++. The paradigm of directly accessing methods and instance variables inside a class is bad. It's too easy to confuse them with a static member. Java has plenty of spare syntax to make it easy:
    public void foo() {
        return foo;      // Instance or static var?
    }
    
    public void bar() {
        return this.bar; // clear, but bad Huffman coding!
    }
    
    public void bar() {
        return :baz;     // nice and perl6'ish!
    }
  8. No operator overloading. I know some people don't like this, but I do. We could avoid all sorts of object.equals(thingy) shenanigans and save on typing. object == thingy please.
  9. The compiler error messages suck. We'll, more to the point the tools we've been told to use suck. I have a very nice editor, I would like to use it.
  10. Exceptions: good. Declaring what exceptions a method might throw: handy. Having to do that all over the place just to use a damn exception: crap.
Posted: September 16, 2005 3:50 AM

Post a comment