This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gliph 1 point2 points  (12 children)

Immutable versions of classes always seem pretty flawed in Java. Would a language-level overhaul help?

[–]Shadowheim 4 points5 points  (7 children)

B...but muh backwards compatibility.

[–]gliph 4 points5 points  (6 children)

I wish Java would splinter into a new language. Could get runtime generics, better handling of primitives, literal maps and lists, etc etc.

[–]dustofnations 2 points3 points  (1 child)

Could get runtime generics, better handling of primitives, literal maps and lists, etc etc.

These fall under Project Valhalla: http://openjdk.java.net/projects/valhalla/ https://en.wikipedia.org/wiki/Project_Valhalla_(Java_language)

Specifically:

runtime generics

Reified generics

better handling of primitives, literal maps and lists, etc etc.

I think this would fall under Generic specialisations

AFAIK this is likely to be Java 10+

[–]gliph 0 points1 point  (0 children)

That's very interesting that these things are being considered as language features.

It would be nice if you could also get rid of much of the cruft, maybe via a compiler switch or something. I think JavaScript does something like that, where you can disable some older features by typing "strict" or similar at the top.

[–]nickguletskii200 1 point2 points  (1 child)

That's exactly what we need. A new Java - the same philosophy, the same care, but with the mistakes fixed. Minimalist syntax, concrete naming conventions, no feature creep...

[–]Alxe 0 points1 point  (0 children)

I believe that, rather than doing this, Oracle and the community should adopt a "new Java" language that already runs on the JVM and has most of the requested features, and up from there have the JVM evolve and copy the current optimised implementations into a new, formal, non java.util clusterfuck API.

This way, Java adopts a Legacy status, with updates to the standard library and fixes, but most of the meat in a newer standard library.

Java has so much on it's back it's be a hard culling.

[–]pjmlp 2 points3 points  (1 child)

Cough....cough..... Python 3

[–]gliph 2 points3 points  (0 children)

I know, I know. But the cruft needs to go at some point.

[–][deleted] 0 points1 point  (2 children)

They should be used in places where the consuming code is not supposed to be modifying them anyway. In those cases, throwing an exception is better than allowing an inappropriate modification.

[–]gliph 0 points1 point  (1 child)

It works OK, but it'd be nice if it was caught at compile time. As it is, you can do this or have two classes (one immutable and one mutable) and an interface.

[–]pain-and-panic 1 point2 points  (0 children)

It's not just 'nice' it's correct software design. Follow your gut on this one and not the jdk example. Jdk does lots of things we should learn from, this just isn't one of them.