Java 5.0 goes the wrong way, Groovy goes too far
There are things that I think we could add to Java to make it more attractive language to dynamic language developers and cut the syntax down. At the same time, Groovy introduces many optional features that I don’t like from a maintainability and correctness perspective.
I’m not going to repeat all the things I have said in the past about generics, instead I am going to create a new language with backwards compatibility to Java, better syntax, and more features. Here we go:
To reduce redundancy in the code I will introduce Auto-casting. What this does is that if an object could be cast in place to satisfy a constraint then the compiler would do that. It will fail if the auto cast is ambiguous or if it would fail if the programmer put the cast in explicitly.
Map p = new HashMap();
String s = p.get(“test”);
MyEJBHome home = new InitialContext().lookup(“java:comp/env/ejb/MyHome”);
2) using a factory like new method instead of an operator.
StringBuffer sb = StringBuffer.new();
3) Reflective invocation operator to allow objects to have shapes without explicit interfaces.
Object s = “test”;
s = s->trim();
4) Closure-like (lite) anonymous inner classes. If an anonymous inner clasc c