<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4"><font face="monospace">We explored this topic
somewhat when designing the feature. <br>
<br>
When you override a method x, you can still delegate (via
super.x()) to the thing you override. We considered doing the
same here (delegating to default.x()), but concluded that this
failed the power-to-weight-ratio test, because usually you do
not want to _refine_ an equals/toString/hashCode calculation,
but instead broaden it (such as comparing arrays by contents
rather than by ==.) <br>
<br>
If you pull on this "string" a bit, the API that you would want
here is complex and enormous, and has as many tuning knobs as a
Lombok. So refactoring records that customize Object methods
becomes a higher-responsibility activity. Leave "future you"
some comments for what you were thinking today.<br>
<br>
<br>
</font></font><br>
<div class="moz-cite-prefix">On 9/21/2023 1:00 PM, David Alayachew
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAA9v-_OqfE19u7QUrfMB9rYdUE=-PQvUXUceYy1J2kz_YxVXYw@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace">Hello
Amber Dev Team,</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">Let's
say I have a record like the following.</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">record
ComplexRecord(int blah /* and many more components */) {}</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">Next,
let's say that I want to override my toString, to include some
derived information.</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">Obviously,
putting the derived info into the toString is easy, but how do
I go about INCLUDING it with my original implementation of
toString that was magically created for me by Java?</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">If I
try to fully recreate my toString, I run the risk of it
becoming out-of-date upon refactor. Best I can come up with is
nesting another record with the toString overloaded. Also not
ideal.</div>
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">Thank
you for your time!</div>
<div class="gmail_default" style="font-family:monospace">David
Alayachew<br>
</div>
</div>
</blockquote>
<br>
</body>
</html>