It seems to me that, in some ways, Java is where C was a while back. Both are fairly minimalist languages for their time, with relatively clean, simple cores to build on. (I'm referring to the core language here, not the libraries.) Both are/were extremely popular. Both are/were lingua francas, with tons of legacy code. Both are/were lacking several modern productivity features that programmers from other languages often miss. Both seem very inertia-dominated and slow to adapt to a changing world.
It seems to me like it would be reasonable to create a Java++ that's roughly a superset of of Java, as C++ is to C. Such a language would attempt to lift Java out of the relative stagnation it's undergone, break backwards compatibility only in a few minor ways only if absolutely necessary, add lots of modern features that plain old Java is missing, and worry about standardization later. Features that might be a good idea include:
- First class functions, delegates.
- Closures.
- Static type inference, similar to
var
in C# orauto
in D. - Operator overloading.
- Structs as value types distinct from classes, like C# and D.
- Properties.
- An option to ignore checked exceptions.
- The ability to declare more than one top-level public class in a file.
- More powerful builtin arrays that allow things like appending.
- Better generics/real templates.
- Something like the dynamic keyword for C# 4.0 that allows duck typing when necessary in a generally static language.
- Since Java is primarily a VM language, maybe some hardcore metaprogramming features like generating code on the fly for certain things.
Do you think there would be demand for such a language? Do you think such a thing would succeed?
Edit: I'm not talking about compatibility at the runtime/bytecode level, I'm talking about compatibility w/ Java at the source level. Also, yes, Java 7 could add some of these, but it seems like the "official" process for adding features to Java is extremely conservative. The real point is the idea of forking Java into a branch were the focus is on innovation more than stability/standardization.