15 ms·
Why I’m not enthusiastic about Java 10
- geophile 9y agoI have been using Java extensively since the language was released. I'm tired of it. For every release (since JDK 7, maybe), the new features are either irrelevant to me, or a step in the right direction, but not far enough. I think that the major flaws in the language are as follows: - No value types: Coming from C++, I remember my very first reaction to Java was astonishment that it was not possible to physically embed one object in another. This places a real limit on performance. No matter how good optimization and JIT gets, your options for controlling locality of reference in Java are extremely limited. I know there is a proposal for value types, but come on, where is it already? - Type erasure: Type erasure is a lame approximation of parameterized types. Reflection can't see the parameters, and of course they are completely missing at runtime. True parameterized types along with value types would correct a lot of problems. - No real closures: Non-final state cannot be included in a closure. Still. Ridiculous. - Functional programming support: Yeah, streams and lambdas. Not enough. Why do things like "filter" and "map" have to be builtin? Why can't I write my own functional code? And the java.util.function list of Function signature interfaces (e.g. DoublePredicate, IntSupplier) is an abomination. It shouldn't be necessary to explicitly declare these signatures anywhere, let alone enshrine a fixed set of them in a standard library. And the need to provide different versions by type (DoublePredicate, IntPredicate, ...) again points to how broken type parameterization is. That last item is the worst example of piling up kludge upon kludge that I know of in Java. This is really driven home to me as I play with other languages that do functional programming so much better, (Swift, for example, except for the ARC-related kludges).