<div dir="ltr"><div><br></div><div>
<font size="4" face="monospace">> Is
there room for a more restricted category of abstract classes that
records could extend without giving up their semantic benefits and
safety guarantees? Quite possibly, including perhaps the notion
of "abstract record", which permits layered modeling but maintains
the safety guarantees of records? </font>
</div><div><br></div><div></div><div>This is pretty much what I was thinking. An abstract record can extend either java.lang.record or another abstract record. The "non-abstract" record would then extend the abstract one. Just like how we do now for classes and abstract classes. <br></div><div><br></div><div>>
<font size="4" face="monospace">We explored abstract records during the design of records, and
concluded that while they were a possibility, there are a number
of details to work out, some of which are a little uncomfortable. </font> <br></div><div><font size="4" face="monospace"><br></font></div><div><font size="4" face="monospace">> So there is room to explore this further, but it is not currently
a topic of active investigation.</font>
</div><div><br></div><div> I hadn't even thought of the implications of valhalla. Even though it is not an active topic of investigation, would you please share what the uncomfortable details were? (I am asking out of sheer curiousity).<br></div><div><br></div><div>Glad to hear the idea has not been ruled out completely.</div><div><br></div><div>Thanks Brian,</div><div><br></div><div>Regards,</div><div>Vikram<br></div><div><br></div><div><br></div><div><br></div><div>Good to know it is a future possibility<br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 28, 2023 at 4:38 PM Brian Goetz <<a href="mailto:brian.goetz@oracle.com">brian.goetz@oracle.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"><u></u>
<div>
<font size="4" face="monospace">It depends what you mean by
"inheritance". <br>
<br>
Will records ever be able to extend an arbitrary class like
SocketInputStream? That's a pretty clear "definitely not." Is
there room for a more restricted category of abstract classes that
records could extend without giving up their semantic benefits and
safety guarantees? Quite possibly, including perhaps the notion
of "abstract record", which permits layered modeling but maintains
the safety guarantees of records? <br>
<br>
We explored abstract records during the design of records, and
concluded that while they were a possibility, there are a number
of details to work out, some of which are a little uncomfortable.
(Separately, in Valhalla, we have explored what is required for an
abstract class to be extendible by a value class, which might also
inform an answer.) <br>
<br>
So there is room to explore this further, but it is not currently
a topic of active investigation.<br>
<br>
</font><br>
<div>On 12/28/2023 9:59 AM, Vikram Bakshi
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hello,</div>
<div><br>
</div>
<div>Is the decision to not allow inheritance for records set in
stone? Or will this be opened up and explored in the future?</div>
<div><br>
</div>
<div>One of the goals of records (from Brian Goetz Devoxx talk)
is to "model data as data", and allowing inheritance would
offer a powerful way of modelling data. <br>
</div>
<div><br>
</div>
<div>Right now we have to write interfaces for fields which are
shared/static methods for shared behaviour/copying and pasting
- which I do not think is ideal.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Vikram<br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</blockquote>
<br>
</div>
</blockquote></div>