Queries regarding value classes

Julian Waters tanksherman27 at gmail.com
Sat Mar 19 06:50:02 UTC 2022


My naive understanding is that the reference to the original object that
was created would still change only it, while the new inlined object would
then be accessed by another reference, but I am not sure if this is correct.

best regards,
Julian

On Fri, Mar 18, 2022 at 9:37 PM Pedro Lamarão <pedro.lamarao at prodist.com.br>
wrote:

> 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