|
|
Tuesday, November 04, 2003 |
On the 1.5 Java Language Extensions.I was reading the (old) chat at the Javasoft site. It's got some insight from the developers...here are a few comments... On Generics: Nice addition to the language, but for the love of God why aren't primitive types included? After all this time, I still cannot make an efficient map of integers to doubles, or any other primitive type combination. What's missing is a generic-type capable implementation of a BTree...this will lead to some serious compaction in atomic data storage... Typesafe Enums: Nice to have, like'em, but Delphi did it better 47 million years ago. Bit mask sets were perfect for tons of different things, and they're still perfect today. A tiny little bit of syntactic sugar is all that's necessary to make them work. Why should I incur hundreds of bytes of overhead to store a set of enums? It makes no sense. And if you want to treat them like real objects, the compiler can autobox into a typesafe enum object. Just keep the representation in the field structures as compact as possible. Remember, there might be several millions sets. One of the most important uses for enums are flag sets, which just aren't going to be efficient in the proposed scheme.
You don't need pointers to pointers. You need a functional type, which can be used to do pretty much the same thing, with much more flexibility. A proper functional type doesn't need an "object" to call a method on -- you can just call a "thing", which can be atomic, a method call, a function call, or a composition of the above, and it returns a result of that type. Of course, you can throw exceptions and they are declared in the functional type's signature. With the generic system you can create containers full of functional objects, and the possibilities are quite endless. Functional type compatibility should be automatic with the compiler -- if the call signatures are compatible, it can be used... This is, in my opinion, the single biggest missing thing in Java. If we had proper functional types, our code would be so much simpler, and we'd all be doing cool higher-order functional programming.
3:59:42 PM |