Criteria for desirable small language changes
By darcy on Dec 23, 2008
The two primary goals of making small language changes in JDK 7 is to:
Make the things programmers do everyday easier.
Support other platform changes in JDK 7.
Over the years, certain common coding patterns have been recognized as needlessly verbose including:
if-equals-X-else-if-equals-Y testing chains on strings
duplicated catch blocks for different exception types
repeated type parameters when declaring and initializing a variable of parameterized type
These patterns can be replaced with new constructs that are more concise and more clear without fundamentally altering the language. Besides improvements to support existing Java programs, language changes should also be made to allow appropriate access to new JVM capabilities, such as those being enabled by the Da Vinci Machine project.
While language changes can fundamentally improve the modes of expression in a language, language changes have a number of drawbacks as solutions to programming problems:
Slow availability: Language changes occur in platform releases, which typically only occur every few years.
Heavyweight: The full extent of a language changes can affect multiple components of the platform.
Changes may be needed at multiple points in the toolchain: Even after a language change is fully available in the JDK, independent libraries and tools may need to be updated as well before the changes can be fully utilized.
Therefore, language changes are rarely the preferred solution if other workable solutions are available. Since IDEs are now commonly used for Java development, mitigating or solving problems using IDE tooling is one possibility. As of Java SE 6, compliant compilers are required to support annotation processing as standardized by JSR 269, see javax.annotation.processing and javax.lang.model. Annotation processing provides a general meta-programming framework; beyond processing annotations directly, annotation processors can be used to implement many currently extra-lingual checks based on a program's structure. Checks which previously would have required language changes can now be implemented by developers and just used by convention. JSR 308, Annotations on Java Types, would enable more detailed checking by allowing annotations in more program locations.
When judging whether or not any change to the platform is worthwhile, a useful notion is estimating the feature's "thrust to weight ratio," that is estimating whether the benefits of making the change exceed the full cost of implementing the change. For language changes, this metric is improved by having a larger fraction of programs potentially benefiting from the change. For example, it would be roughly the same amount of engineering to add numerical operator overloading support for classes like BigInteger and BigDecimal as to add support for bracket, "", syntax for Lists and Maps. Besides complications with the == operator in the numerical case, bracket syntax for Maps and Lists has much higher utility since many more Java programs use Collections than large numbers.
Especially with the maturity of the Java platform, the onus is on the proposer to convince that a language change should go in; the onus is not to prove the change should stay out.
Given the upcoming holidays, the language change proposal form and the seeding proposals will both be coming in January 2009.