3 ms·
And Java will soon have StableValue: https://openjdk.org/jeps/8312611 https://openjdk.org/jeps/8312611
by cempaka 2y ago
And Java will soon have StableValue: https://openjdk.org/jeps/8312611 https://openjdk.org/jeps/8312611
- neonsunset 2y agoReading the JEP, isn’t StableValue about JIT constants? In .NET it’s just 'static readonly'.
- cempaka 2y agoThe basic feature set is at-most-once thread-safe initialization of values, which can then enjoy the same constant folding and other JIT optimizations one would get from `static final`, but can be initialized at any point during the program's run.
- mrkeen 2y agoNon-goals It is not a goal to provide Java language support for declaring stable values. Hmmm
- jcrites 2y agoFrom context, I would infer that this means they are not changing the Java language itself. It’s a feature expressed through the existing language, like as a library feature. I could be wrong though.
- cempaka 2y agoYes you're correct, the idea is that they're not adding any keywords or bytecodes, just some new standard lib APIs that will get some special treatment by the JVM.