6 ms·
I admit that I am not an expert on Scala, but I am confused about your "Person" example. I thought that this was exactly the common use case that wouldn't cost
by neukoelln 10y ago
I admit that I am not an expert on Scala, but I am confused about your "Person" example. I thought that this was exactly the common use case that wouldn't cost you an allocation.
According to http://docs.scala-lang.org/overviews/core/value-classes.html http://docs.scala-lang.org/overviews/core/value-classes.html:
A value class is actually instantiated when:
a value class is treated as another type.
a value class is assigned to an array.
doing runtime type tests, such as pattern matching.
none of which is the case in the example.