Live data from Hacker News

JEP 401: Value Objects (Preview) merged to OpenJDK master

github.com

91–100 of 185 posts

Re: JEP 401: Value Objects (Preview) merged to OpenJDK master

#91
post #73

Earlier quoted context omitted.

Of particular note, all 1-byte Integers are interned, there is a pool of small Integers from -127 127 which are reused whenever possible. I learned this the hard way, when a C++ JNI extension I was working on accidentally overwrote the pooled value for zero, and all hell broke loose...

Yeah - it's a bit non-intuitive you can change the value of a number. https://thedailywtf.com/articles/Disgruntled-Bomb-Java-Editi...

In Python 2 you could literally do

    True = False
and of course in JavaScript

    undefined = "a string"

Re: JEP 401: Value Objects (Preview) merged to OpenJDK master

#93
post #15

I feel lonely in that: I mostly love Java as a language. The lack of value types is the biggest impediment to certain types of performance. I am really looking forward to this evolution of the language.

What I love the most is the sheer amount of thought and philosophy put into Valhalla. It transcends the binary understanding of object vs value and actually defines 4 distinct buckets: 1: Classical Object 2: Object without identity 3: Atomic Value 4: Classical Value (Tearable) Each bucket has clearly defined performance characteristics and semantic constraints. So depending on the nature of your data, you can always…

this comment reads like a parent who can’t help but love their child unconditionally and uncritically.

That’s a lot of complexity a lot of other languages don’t even need. It’s great Java designers have managed to shoe horn something in, but it’s all because of misdesigns 30ish years ago mispredicting of computer architecture.

Re: JEP 401: Value Objects (Preview) merged to OpenJDK master

#94

Earlier quoted context omitted.

java the language is amazing the problem with it is entirely cultural. why is `IStatusChangeEntityCreationManagerFactory` everywhere? and why are the frameworks so huge and all encompassing? i think batteries included rails-style frameworks are great, but when i wrote Java, it didn't feel like rails at all none of these are language problems

Most languages simply don't have all the frameworks that were created specifically for use in an enterprise context. There's cobol and there's maybe C#, Java and then a long tail of everything else. A lot of the Java stuff actually came out of the Smalltalk community. IBM used to employ a lot of these people and they brought their enterprise stuff with them when things like Enterprise Java Beans became a thing. And b…

> Most languages simply don't have all the frameworks that were created specifically for use in an enterprise context

And yet a lot of enterprises have done without in other languages.

Re: JEP 401: Value Objects (Preview) merged to OpenJDK master

#95

Earlier quoted context omitted.

What I love the most is the sheer amount of thought and philosophy put into Valhalla. It transcends the binary understanding of object vs value and actually defines 4 distinct buckets: 1: Classical Object 2: Object without identity 3: Atomic Value 4: Classical Value (Tearable) Each bucket has clearly defined performance characteristics and semantic constraints. So depending on the nature of your data, you can always…

this comment reads like a parent who can’t help but love their child unconditionally and uncritically. That’s a lot of complexity a lot of other languages don’t even need. It’s great Java designers have managed to shoe horn something in, but it’s all because of misdesigns 30ish years ago mispredicting of computer architecture.

While I agree with the comment being overly-praise-y, this is complexity that any multithreaded language with mutability and reasonable sanity/safety desires (but without intrusive compile-time rules a la Rust) has; others just might pretend some of the options don't exist / aren't desirable. (..and value objects, as landed in the PR, doesn't yet have tearable objects)

Re: JEP 401: Value Objects (Preview) merged to OpenJDK master

#96

Earlier quoted context omitted.

Whatever Java is doing seems a few orders of magnitude smoother and saner than C++ (and I like C++).

It depends on how you look at it. C++ is very different since it is native. Java is a VM. This affects lots of decisions in weird ways. But in essence both commit to backwards stability at the end. C++ goes for performance, JVM for a more full-featured bytecode vm, etc. but still.

None of that prevents Java from blowing up their language with complex features. They are somehow able to sit back and work on proposals for years and end up with what makes sense for the language.

Re: JEP 401: Value Objects (Preview) merged to OpenJDK master

#97

Earlier quoted context omitted.

java the language is amazing the problem with it is entirely cultural. why is `IStatusChangeEntityCreationManagerFactory` everywhere? and why are the frameworks so huge and all encompassing? i think batteries included rails-style frameworks are great, but when i wrote Java, it didn't feel like rails at all none of these are language problems

Show me where IStatusChangeEntityCreationManagerFactory is in the language. Or the standard libraries. Or anything like it

https://docs.spring.io/spring-framework/docs/current/javadoc...

Re: JEP 401: Value Objects (Preview) merged to OpenJDK master

#98
> Generic types such as List and Comparable can be instantiated with value classes as the type arguments.

> JEP 218, Generics over Primitive Types (with revisions), will allow generic classes and methods to specialize field, array, and local variable layouts when parameterized by value class types.

Ok now this is cool! JVM needs more ways to use compile time known value sizes for better memory allocation and optimizations.

Re: JEP 401: Value Objects (Preview) merged to OpenJDK master

#99

Earlier quoted context omitted.

I used to love Java mostly for its batteries-included well designed standard library. Despite the verbosity of the language itself. But over time the language has really evolved a lot and gotten a lot more pleasing to the eye (in my opinion).

At some point I thought there was no way back compared to C#. But nowadays I see the language improved a lot, avoided async/await and added virtual threads, added records, now Valhalla, decent lambdas and tons of quality of life improvements. In the meantime C# became a monster of 2000 ways to declare properties init get, set, backed, not backed, stackalloc, structs, etc. And I know it is done for performance: but Ja…

100% agree.

They added so much new syntax to C# to the point it really is starting to feel like C++++ whereas Java has modernized itself without massively expanding its syntax and modifiers.

Re: JEP 401: Value Objects (Preview) merged to OpenJDK master

#100

Really cool, shame that strings can’t be fully indistinguishable like Integer despite their immutability

I don't think there's a lot of gains to be had for strings. Perhaps if you are dealing with a very large amount of small strings then it could be useful, but once you get past a few characters strings it's faster to just send around a reference anyways.
Post reply on HN