Re:Java 22 Released
by okeuro49 on Wednesday March 20, 2024 @06:59AM
(#39764872)
I really dislike this feature.
It's better to just say "we will come to this concept later", rather than make a fake syntax that does this (taken from the JEP) behind the scenes:
new Object() {
// the implicit class's body
}.main();
It adds more confusion, as you are left explaining that you could not really run an instance method without instantiating the class -- it was just something fake for beginners.
Re:Java 22 Released
by Shakahs on Wednesday March 20, 2024 @07:31AM
(#39765057)
I agree. Coming from NodeJS I appreciate how explicit Java is.
The complexity is there either way, but in Java it's right up front where I can see it, not hidden away under layers of abstraction for a supposedly better DX.
It's better to just say "we will come to this concept later", rather than make a fake syntax that does this (taken from the JEP) behind the scenes:
new Object() { // the implicit class's body }.main();
It adds more confusion, as you are left explaining that you could not really run an instance method without instantiating the class -- it was just something fake for beginners.