3 ms·
https://docs.scala-lang.org/sips/value-classes.html https://docs.scala-lang.org/sips/value-classes.html
by halfmatthalfcat 6y ago
https://docs.scala-lang.org/sips/value-classes.html https://docs.scala-lang.org/sips/value-classes.html
- chrisseaton 6y agoAh right - that's not really what we're talking about here, even though they have the same name.
- halfmatthalfcat 6y ago“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.
- bcrosby95 6y ago> must have exactly one parameter, Huge limitation. Not anywhere near the same thing.
- chrisseaton 6y agoWhat 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.