Mixing up value types and reference types
Vitaly Davidovich
vitalyd at gmail.com
Wed Oct 1 23:17:14 UTC 2014
Even with immutable value types, there's a performance difference between
returning a new value type vs reference type or passing it around as a
parameter.
But can't this be handled by things like the IDE, with different coloring
or whatnot?
As for mutable value types, they're useful in perf sensitive contexts where
they're used simply as identity-less containers of data. Think an array of
them. Updating each one via copying into a new one is less than ideal.
But that's an aside, carry on :).
Sent from my phone
On Oct 1, 2014 6:58 PM, "Simon Ochsenreither" <simon at ochsenreither.de>
wrote:
> Isn't the potential of confusion you have demonstrated more or less a
> consequence of C#'s decision to allow mutable value types?
>
> I'm not strongly claiming that immutable value types don't have this issue
> (although I would tend to assume it, because I can't remember hitting such
> an
> issue in Scala since the introduction of value types).
>
More information about the valhalla-dev
mailing list