At some point (hopefully in time for Java 10), we are likely to get Project Valhalla. When that happens, will value types gain functionality to be roughly as powerful as Java’s?
Currently, value types can only wrap a single value. As I understand it, this is primarily in order to allow their methods to be compiled into static methods on the underlying type. Additionally, having a value type extend a trait causes it to box when invoking one of the trait’s methods.
When Valhalla finally arrives:
- Will value types change to be implemented as Java/JVM value types (instead of static methods)?
- Will value types be allowed to have more than one value/field?
- If so, will tuples become value types? All, or only smaller tuples? (because passing a
Tuple20would require copying 20 fields)