News for hackers. Stuff that matters.
Re:Paving the on-ramp to Java by kaashif on Saturday October 01, 2022 @11:24PM (#33052530)
Not really. In Java you can do all kinds of things with immutable wrappers, but the language doesn't help you and it doesn't come for free for your own types.

In C++ you can write a class with some methods that mutate, and some const methods that can't mutate anything, and you can pass around const references through which mutation is guaranteed to be impossible. This all comes for free.

Re:Paving the on-ramp to Java by barbarbar on Sunday October 02, 2022 @10:11AM (#33056005)
This was added a couple of years ago https://docs.oracle.com/en/java/javase/17/docs/api/java.base....

I was thinking that would make it possible to create unmodifiable data objects using that (and not Object as base class).