<div dir="auto"><div dir="auto">Thank you both. So the answer boils down to, not enough realized value for the effort involved. More specifically, it may foreclose on other things while not really giving us much at all. Makes sense, and that's fair.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br><br><div style="min-width:150px" dir="auto"><div dir="ltr">On Tue, Sep 23, 2025, 8:31 AM Remi Forax <<a href="mailto:forax@univ-mlv.fr" target="_blank" rel="noreferrer">forax@univ-mlv.fr</a>> wrote:<br></div><blockquote style="min-width:150px;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:'arial','helvetica',sans-serif;font-size:12pt;color:rgb(0,0,0)"><div><br></div><div><br></div><hr><div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;font-family:helvetica,arial,sans-serif;font-size:12pt"><b>From: </b>"David Alayachew" <<a href="mailto:davidalayachew@gmail.com" target="_blank" rel="noreferrer">davidalayachew@gmail.com</a>><br><b>To: </b>"valhalla-dev" <<a href="mailto:valhalla-dev@openjdk.java.net" target="_blank" rel="noreferrer">valhalla-dev@openjdk.java.net</a>><br><b>Sent: </b>Tuesday, September 23, 2025 2:19:40 PM<br><b>Subject: </b>Question about Value Classes and inheritance<br></blockquote></div><div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;font-family:helvetica,arial,sans-serif;font-size:12pt"><div dir="auto">Hello <span dir="auto"><a href="mailto:valhalla-dev@openjdk.java.net" style="color:rgb(17,85,204)" target="_blank" rel="noreferrer">@valhalla-dev</a></span>,<div dir="auto"><br></div><div dir="auto">I read through JEP 401, and the subsection about subtyping surprised me.</div><div dir="auto"><br></div><div dir="auto">It appears that Abstract Value Classes can permit both Value child classes and Identity child classes. The example of BigInteger helps explain why.</div><div dir="auto"><br></div><div dir="auto">Ok, but there doesn't seem to be any way to say "only value classes can extend me!"</div><div dir="auto"><br></div><div dir="auto">Why is that?</div><div dir="auto"><br></div><div dir="auto">And to be clear, I am not bothered by Abstract Value Classes permitting Identity children, that's fine.</div></div></blockquote><div><br></div><div>I'm glad this is fine by you because it's important for backward compatibility, it means that you can declare an existing abstract class has "value enable", without requiring sub-classes to be changed.</div><div><br></div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;font-family:helvetica,arial,sans-serif;font-size:12pt"><div dir="auto"><div dir="auto">I'm moreso confused by lack of ability to say "only value children".</div></div></blockquote><div><br></div><div>Declaring a class has a value class is really close to be an implementation detail (it mainly depends on if your code abuse of == or not),</div><div>so why do you want such ability ?</div><div><br></div><div><br></div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;font-family:helvetica,arial,sans-serif;font-size:12pt"><div dir="auto"><div dir="auto"><br></div><div dir="auto">Thank you for your time and consideration.</div><div dir="auto">David Alayachew</div></div></blockquote><div><br></div><div>regards,</div><div>Rémi</div><div><br></div></div></div></div></blockquote></div></div><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Tue, Sep 23, 2025, 9:33 AM Brian Goetz <<a href="mailto:brian.goetz@oracle.com" rel="noreferrer noreferrer noreferrer" target="_blank">brian.goetz@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;line-break:after-white-space">
<div>
<blockquote type="cite">
<div>
<div dir="auto" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
Ok, but there doesn't seem to be any way to say "only value classes can extend me!”</div>
</div>
</blockquote>
<br>
</div>
<div>At some level, this is a matter of taste and return-on-complexity. Obviously this is not _needed_, but some programmers are clearly comforted by the ability to capture this intent. Of course, adding such restriction adds complexity at every layer; it
needs a syntactic expression, it needs a clasfile representation, it needs static type checking, it needs dynamic enforcement, it needs reflection, etc. So the first question is: does the incremental expressiveness justify the incremental complexity? </div>
<div><br>
</div>
But more importantly, as Remi points out, seemingly harmless “intent capturing” things at the source level can turn into unexpected difficulties for longer term issues such as migration compatibility. We saw a similar example of this in Java 8, where people
asked “why can’t I make a default method final”, but then when you show them the impossible problems this creates for subclasses, they change the subject. Foreclosing on possibilities like this, that are often “over the maintenance horizon”, are often “shallowly
sensible” but make the ecosystem brittle.
<div><br>
</div>
</div>
</blockquote></div></div>