Queries regarding value classes

Pedro Lamarão pedro.lamarao at prodist.com.br
Fri Mar 18 13:37:22 UTC 2022


Em sex., 18 de mar. de 2022 às 09:03, Julian Waters <tanksherman27 at gmail.com>
escreveu:


> I suspect the misunderstanding in the thread is caused by my
> confusion of what value classes actually *are*, I'm still having a hard
> time figuring out how a reference object cannot be mutated
>

This is my understanding as a layman, not a Valhalla expert.
Suppose you create some value class object.
It lives in the heap.
Then you pass it around.
Then an opportunity arises and this object is inlined in some other object.
You still have a reference to the object you created initially.
You change a field on that object through that reference.
What do you expect must happen with the inlined version?

-- 
Pedro Lamarão



More information about the valhalla-dev mailing list