<div dir="ltr"><div><br></div><div>> I almost spill my tea :)

</div><div><br></div><div>:)</div><div><br></div><div>
<div>> Inheritance is about sharing behaviors, so the data behaviors 
should not change too much. But business requirement, business 
data/computation changes are frequent, so using inheritance is a kind of
 an an anti-pattern for data.</div><div><br></div>

</div><div>Is it really an anti-pattern in all situations though? There have been times where I have wanted my record to inherit from a record representing some "id" which itself contains methods/behaviour. I can think of it being useful in some situations.<br></div><div></div><div><br></div><div>
<div>> It's far far easier to use records, empty interfaces and pattern 
matching (switch on types) when you want to define data and their 
business rules than tryig to use inheritance for a case it will not work
 well.</div>

</div><div><br></div><div>I think allowing the developer the flexibility to choose whether or not they would like inheritance would still be a valid "Java" way of doing things.  <br></div><div><br></div><div>I understand from Brian's email that record inheritance is currently shelved so we will have to wait and see if it ever becomes a priority (other upcoming features like the "state monad" for records are probably more important anyway <a href="https://github.com/openjdk/amber-docs/blob/master/eg-drafts/reconstruction-records-and-classes.md">https://github.com/openjdk/amber-docs/blob/master/eg-drafts/reconstruction-records-and-classes.md</a>). </div><div><br></div><div>Regards,</div><div>Vikram<br></div><div> <br></div><div><br></div><div><br></div><br><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 29, 2023 at 2:05 PM Remi Forax <<a href="mailto:forax@univ-mlv.fr">forax@univ-mlv.fr</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"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><div><br></div><div><br></div><hr id="m_6840048097803779319zwchr"><div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>From: </b>"Vikram Bakshi" <<a href="mailto:vab2048@gmail.com" target="_blank">vab2048@gmail.com</a>><br><b>To: </b><a href="mailto:amber-dev@openjdk.java.net" target="_blank">amber-dev@openjdk.java.net</a><br><b>Sent: </b>Thursday, December 28, 2023 3:59:10 PM<br><b>Subject: </b>Allowing inheritance with Records?<br></blockquote></div><div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><div dir="ltr"><div>Hello,</div><br><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><br><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. </div></div></blockquote><div><br></div><div>I almost spill my tea :)<br></div><div>Inheritance is about sharing behaviors, so the data behaviors should not change too much. But business requirement, business data/computation changes are frequent, so using inheritance is a kind of an an anti-pattern for data.</div><div><br></div><div>It's far far easier to use records, empty interfaces and pattern matching (switch on types) when you want to define data and their business rules than tryig to use inheritance for a case it will not work well.</div><div><br></div><blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><div dir="ltr"><div><br></div><br><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><br><div>Regards,</div><div>Vikram<br></div></div></blockquote><div><br></div><div>regards,<br></div><div>Rémi<br></div></div></div></div></blockquote></div>