<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Meanwhile, I have another question about nullable object<br>representation in value classes: Suppose we have<br>Optional<Optional<Optional<String>>>, what will the representation be?<br>How will we distinguish Optional.empty() with<br>Optional.of(Optional.empty())?<br></blockquote><div><br></div><div>To my knowledge, value objects as fields are usually not inlined, so <br>the representation of Optional.of(Optional.empty()) in heap remains the same as it is now.<br><br>If you want a field to be inlined, its class should be a primitive class.<br>Value objects are usually only inlined when used as local variables.<br></div><div><br></div><div>Glavo </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 25, 2023 at 9:39 PM - <<a href="mailto:liangchenblue@gmail.com">liangchenblue@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
I just wonder if nullable reference pointers can be part of compact<br>
value objects.<br>
<br>
For instance, in the Classfile API, there is StackMapGenerator.Type, a<br>
record with (int type, ClassDesc reference, int bci). The default<br>
state (0, null, 0) is valid and a desirable default (0 type means<br>
top-type). If the ClassDesc field can be part of the compact<br>
representation, then the whole structure can be optimized, which looks<br>
promising to me.<br>
<br>
Meanwhile, I have another question about nullable object<br>
representation in value classes: Suppose we have<br>
Optional<Optional<Optional<String>>>, what will the representation be?<br>
How will we distinguish Optional.empty() with<br>
Optional.of(Optional.empty())?<br>
<br>
Thanks,<br>
Chen Liang<br>
</blockquote></div>