<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Vikram Bakshi" <vab2048@gmail.com><br><b>To: </b>amber-dev@openjdk.java.net<br><b>Sent: </b>Thursday, December 28, 2023 3:59:10 PM<br><b>Subject: </b>Allowing inheritance with Records?<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;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 data-mce-bogus="1"></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 data-mce-bogus="1"></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 data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;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 data-mce-bogus="1"></div><div>RĂ©mi<br data-mce-bogus="1"></div></div></div></body></html>