by Janice J. Heiss May 1, 2003 Guy Steele, a Sun Fellow at Sun Microsystems, is responsible for research in language design and implementation strategies, architectural and software support, and for the specification of the Java programming language. The recipient of many awards, he has a Ph.D. in computer science from MIT, has authored or co-authored five books and many articles, and has contributed to the specifications for several other programming languages, including C, Fortran 90, High Performance Fortran, Common Lisp, Scheme, and ECMAScript. His recent research focus includes such diverse areas as network design for processor clusters, circuit designs for floating-point arithmetic, and proposals for improvements for the Java programming language, such as generic types, operator overloading, and constant classes.
Some concepts are more powerful, more general, more widely used than others -- "liberty" and "mortgage" are more widely used than "belly button ring" or "faucet wrench". But every new word, every new meaning, every new idiom enriches the language.
You once said that it would be a good thing for the Java language to add generic types and let the user define overloaded operators. What progress has been made on this? What more rules are needed at this juncture?
Overloaded operators are still a subject of controversy. They are almost indispensable for certain kinds of mathematical work, but people who oppose adding them to the Java language point out, quite rightly, that the feature was badly abused in C++ for nonmathematical purposes, making code much harder to read than necessary. Most Java applications are nonmathematical in nature. One could make a good argument that commercial applications have no need for operator overloading, except that commercial applications do use (or should use) BigDecimal arithmetic, and it would be really nice to be able to use + and - and * and / with BigDecimal numbers. Much the same can be said of so-called "lightweight classes": their greatest value would lie in supporting numerical concepts such as complex numbers and interval arithmetic.
We have an interesting decision to make that is more a political or business question than a technical one: should the Java language be extended to support the needs of mathematical applications? If so, then I would argue strongly for introducing operator overloading and lightweight classes -- I'm pretty sure such facilities would also get used for other purposes. If not, then maybe we should just make + and - and * and / work for the BigInteger and BigDecimal classes as a special case, much the same way that + is already a special case for the String class.
Aside from that, I don't think I'm here to tell Java developers what to do. I want them to tell me what to do. I'm a tool-builder, a tool designer, and I need to know what developers would find useful. (Before I get swamped with email, let me note that my expertise is in the base language itself, not the libraries and APIs!)
So, for example, I think it would be a mistake to extend the language to the point that for (int i=0, i<n, i++) System.out.println(i); would be considered correct code, even if I had some very clever reason why using commas instead of semicolons could convey some useful twist, because it would be too easily confused with the usual for (int i=0; i<n; i++) System.out.println(i); Also, there is power in knowing that there are some things that you just can't say in a language. It's really helpful to a programmer to know that, for example, local variables are effectively "private" and so another method can't unexpectedly alter the value of a local variable. It's such a valuable principle that I think it would be a bad idea to extend the language to allow methods to access each other's local variables. Designing a good programming language isn't just a matter of throwing together a set of features; it's a matter of establishing important principles that the programmer can rely on. It's important to follow those principles as a language is extended. Sometimes the principles themselves can be extended, but only with great care. Here are four examples of important principles in the Java language: local variables are private, you can't violate the type system, the evaluation order goes from left to right, and the "equals" method is symmetric and transitive.
Little did I know. A year later, Bill Joy called me up and said, "Its new name is 'Java,' and we think it's going to be a big deal. Help me write the language specification!" And it did turn out to be a big deal. This reminds me of an earlier incident when Larry Smarr, who directs the National Computational Science Alliance, first told me, over lunch, about an amazing new technology called the "World Wide Web" and interactive file browsers. I was skeptical then, too, but a year later I told him, "I was wrong, you were right!" I was born in Missouri, the "Show Me" state, so maybe I do take a little bit of convincing. The one virtue I will claim is that I don't get stuck on my first impression. I keep an open mind and am ready to jump on board when the time is right. And once I'm on board, I am really tenacious about working out the nit-picking details and corner cases until everything is just right. See Also
Coding from Scratch
The Future of Virtual Reality
| |||||||||
Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.
|
| ||||||||||||