Re:A categorized list of all Java and JVM features since JDK...
by halfmatthalfcat on Thursday April 01, 2021 @01:32PM
(#26663624)
Or use Scala :)
[ Parent
| on HN ]
Re:A categorized list of all Java and JVM features since JDK...
by kaba0 on Thursday April 01, 2021 @03:18PM
(#26664863)
Which doesn’t have value types because it should be implemented in the JVM?
Re:A categorized list of all Java and JVM features since JDK...
by halfmatthalfcat on Thursday April 01, 2021 @03:33PM
(#26665034)
It has Value Classes which are essentially the same thing. They transpile down into the value itself but wrap the value in extra functionality if you so choose.
Re:A categorized list of all Java and JVM features since JDK...
by kaba0 on Thursday April 01, 2021 @03:54PM
(#26665246)
They can only wrap a single primitive type - it’s a nice feature but nothing extraordinary. When Java implements primitive types, Scala will probably use this same construct. But the change have to come from the runtime level.
Re:A categorized list of all Java and JVM features since JDK...
by chrisseaton on Thursday April 01, 2021 @03:31PM
(#26665010)
Does Scala have value types?
Re:A categorized list of all Java and JVM features since JDK...
by halfmatthalfcat on Thursday April 01, 2021 @03:35PM
(#26665053)
Re:A categorized list of all Java and JVM features since JDK...
by chrisseaton on Thursday April 01, 2021 @03:39PM
(#26665086)
Ah right - that's not really what we're talking about here, even though they have the same name.
Re:A categorized list of all Java and JVM features since JDK...
by halfmatthalfcat on Thursday April 01, 2021 @03:52PM
(#26665231)
“Codes like a class, works like an int!” - Taken from the top of the page.
This is exactly what Value Classes are in Scala. You supply an underlying value which is then interpreted as the value itself, not a reference.
Re:A categorized list of all Java and JVM features since JDK...
by chrisseaton on Thursday April 01, 2021 @04:31PM
(#26665643)
What you're talking about is just wrapping a single value. It's a type-system thing.
What we're talking about are wrapping compound values. It's a VM implementation thing.
They're not really comparable.