X
Tech

Step away from the compiler

Java 5 changes were bad enough; let's not repeat the mistake. If you want to program in Ruby, then program in Ruby and be done with it, but leave Java the language alone.
Written by Ed Burnette, Contributor

Earlier this month, Sun engineers proposed extending the language for Java 7 to include closures and local functions. In his blog, Neal Gafter wrote:

Modern programming languages provide a mixture of primitives for composing programs. C#, Javascript, Ruby, Scala, and Smalltalk (to name just a few) have direct language support for function types and inline function-valued expression, called closures. A proposal for closures is working its way through the C++ standards committees as well. ... We anticipate that the additional expressiveness of the language will simplify the use of existing APIs and enable new kinds of APIs that are currently too awkward to express using the best current idiom: interfaces and anonymous classes.

Years ago, Sun considered and rejected bound method references, which are essentially the same as local functions. The reasons given were efficiency and simplicity, though the real reason might have been that Microsoft had introduced the feature unilaterally in Visual J++. Now however, Sun considers C# and Ruby to be competition for the Java language. One part of Sun wants to embrace new languages on top of a universal VM, such as Groovy and JRuby and JavaScript. However another part wants to tack on new language features to make Java "sexier". None is sexier than closures, one of the defining characteristics of Ruby.

My take on it is this: in the real world, many Java developers are still not allowed to use Java 5 language features like generics (though that's likely to pass within the next year). Language changes just fragment the community and put up barriers to free Java implementations like Harmony, Eclipse, and gcj. As a developer I completely understand the irresistible drive to put in fresh new stuff, and I'm very good at coming up with perfectly plausible and logical reasons for it (I hope my manager isn't reading this). But Java language changes have a terrible and long lasting ripple effect on everybody down the chain. If anybody else besides Sun were proposing this, Sun would have a cow. Surely, those language developers can find much better things to do with their time.

Java 5 changes were bad enough; let's not repeat the mistake. If you want to program in Ruby, then program in Ruby and be done with it, but leave Java the language alone.

Editorial standards