Tuesday, April 26, 2011

Java 8.0 Wishlist

With Java 7 almost out the door talk has now shifted to Java 8 and of course it's the perfect time for me to add my own $0.02 on my own wishlist.

Properties.
Dunno what you can do here without annoying a few people. However I'd happily settle for some type of shorthand notation for getters and setters.

Operator overloading.
This one pops up at just about every Java release. Now it seems that there are plans in the works to add indexers to collections and such like. Quite frankly if you're gonna do that, why not add a full complement of fixed operator overloadings, maybe taking some ideas from how Groovy does it

Alternative deployment formats besides the JVM and a class path.
When you have to do one of those client Java applications that everyone claims nobody does, the Java deployment model really bites: Basically I want to create a fully contained application for a target platform. Now if all this contained application does at the end of the day is bootstrap a JVM together with a classpath who cares. It's also worth pointing out that this would allow Java applications to run quite easily on iOS, that is; if someone takes the time to do the port.

Parameter names in method calls.
Nice to have, but it would make DSLs in java nicer.

Finish Autoboxing.
I still can't do 1.toString().

Proxies on Abstract Classes.
Not sure about the technical constraints on this, but it would be great if you could also create proxies on abstract classes and not just on interfaces.

Make JavaFX useful.
Ok so JavaFX is not actually part of the JDK. Whatever the case, it's Oracle's chance to make client side Java really slick.

Well that's my list for now...

6 comments:

Paulo Falcao said...

Operator overloading is very important for graphics. Working with vectors and matrices without operator overloading is not nice :(

Paulo Falcao said...

Operator overloading is very important for graphics. Working with vectors and matrices without operator overloading is not nice :(

Dan said...

To me, properties is my biggest wish. I write a lot of ActionScript 3 (via Flex) and the implementation there is great. I'd love for Java to copy that implementation, which would look like this:

public String get myProperty(){};
public void set myProperty(){};

Could you explain a bit more what you mean by "Parameter names in method calls"? I assume you are referring to having access to them via reflection? Most of the time, if you have the source code your IDE takes care of this automatically, but I imagine it would be nice for the times you don't have the source code for a library.

flying-sheep said...

“Could you explain a bit more what you mean by ‘Parameter names in method calls’?”

i guess he’s talking about keyword arguments like in python, scala, …

afaik that would almost imply default values, because simple reordering of former positional arguments isn’t very useful by itself.

Dandré said...

I've been working on .NET for a couple of years now and I have liked a lot of what's been given so far. Apologies if I mention things that are already fixed, haven't touched Java in ages.
A few things I really would like to see in Java though is maybe the following:
- Properties
- Delegates or at least lambdas
- I don't really care about named parameters but the property initialization like with dot Net would be cool
- Proper Generics. In the early Java 6 versions (don't know if its still like this) if you have a method that returns a value of type T[], you may allocate it to a variable once, after that you will get compiler errors if you try to assign it again.

Some other things I would like in any static-typed language:
- Emitters. C++ has the #VARNAME thing in its defines. I would really like to be able to do the same in Java/C# over a string. This is useful to add some compiler type checking over the symbols emitted. For instance if I were to use reflection I would have to specify a string. Now imagine if I could do something like this: myReflectiveMethod.Invoke( "#(MyProperty)", my_paremeters); Now you have symbol checking, etc. and if you have resharper (Visual Studio) it will rename that as well. There are lots of applications for something like that.

Apologies for long comment.

valjok said...

> Parameter names in method calls. Nice to have, but it would make DSLs in java nicer.

I do not know what is your DSL but named arguments are optional argument enablers. Optional arguments will make API even more nicer.
http://valjok.blogspot.com/2009/01/programming-language-constructor-design.html

The last wish is to use .class attribute applicable to class members. For instance "".equals.class would return a Method. This would eliminate the fragile wordiness of Class.getField(String name) and make pass-by-ref feasible! To pass-by-ref you just need two params: the Filed and object.