Evolving the Java language..
We all know that Java 5 represents one of the most significant evolutions of the Java language since its inception. And Java 5 is taking root and sprouting at different rates in different environments. The tool makers are the rapid adopters, of course. The IT houses are obviously going to proceed more slowly, more cautiously.
So I was thinking about all of these new features in the language, some in APIs, things like annotations, varargs, the foreach statement, and generics. Improving a language is obviously not an easy thing. Especialy if it's an established language. It's a delicate matter. You have to be careful about maintaining compatibility while at the same innovating and adding features of value.
Then something interesting occurred to me, which I thought I'd share with you..
There are a few things in the language which I believe most of us will agree are particularly annoying. I can think of two of them at the moment:
- the fact that the transfer of variables to inner classes requires that these variables be marked final
- the fact that in a constructor we are restricted from using the super() constructor invocation to the first statement in the constructor (that is, we can't invoke super() after having performed some initialization).
So I thought to myself: here's are a few opportunities to improve the java language that are simple and straightforward. Why not address these first?
I'm obviously taking the liberty here to talk about things I know little about. I am not a language design implementor. But we all know that these restrictions don't exist in certain other languages (e.g. ruby); that ultimately they're artificial. There must exist a way to remove these restrictions from the Java language (?). I find it curious that this has not yet been done.