<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<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 class="moz-cite-prefix">On 12/28/2023 9:59 AM, Vikram Bakshi
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CANExk-4rMCNAHqmC9xLfW06KCDyWBcPHPQwjZcB5COcZmQ1onA@mail.gmail.com">
<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>
</body>
</html>