On Tuesday, 5 May 2015 at 20:40:59 UTC, Luís Marques wrote:
Hi,
For a comparison with the Java language, I'm trying to come up
with some good examples of custom types that should be value
types (but that must be ref types in Java). I think the most
obvious ones are numeric types. So BigNum, MyNum, etc. are good
examples because programmers are used to numeric types being
value types, and having them suddenly become a ref type just
because it's MyNum instead of long is really annoying. Still,
could you come up with some type that would really benefit from
being a value type but that isn't numeric (or otherwise
similar)?
Thanks for your help!
Luís
Immutable types?
It doesn't matter whether they are by value or by ref but by
value usually has performance increases(especially considering
you can by a value type by ref in D if you need to).