<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><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;" data-mce-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>"Ethan McCue" <ethan@mccue.dev><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;" data-mce-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="auto">I'd wager the feature being missed in those cases is in-place destructing, less so anonymous components.</div></blockquote></div></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>"Ryan Leach" <rleach@rleach.id.au><br><b></b></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="auto">The way I've seen records adopted and used, seem pretty far removed from Tuples, so don't really understand why you are in support of making them more Tuple-like Remi. I suspect we'll see true Tuples being introduced long before records are considered to be turned into Tuples. Not that I suspect that's particularly likely.</div></blockquote><div><br></div><div>yes, i'm not arguying that records should be tuples, only that for a lot of my students, they see tuples are a building block and Java is missing that.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>As Ethan said, in-place structuring/destructing is another name for tuples (with named components).<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>By examples:<br data-mce-bogus="1"></div><div><div> (int min, int max) minmax(int a, int b) {</div><div> return (Math.min(a, b), Math.max(a, b));</div><div> }</div></div><div> <br> void main() {</div><div> var (min, max) = minmax(7, 3);<br data-mce-bogus="1"></div><div> // or<br data-mce-bogus="1"></div><div> var result = minmax(...(7, 3)); // with a spread operator<br data-mce-bogus="1"></div><div> }</div><div><br data-mce-bogus="1"></div><div>As Brian said, the main issue here is that those things are structural typed, not nominally typed.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Rémi<br data-mce-bogus="1"></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;"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 9 Dec 2024, 3:07 am Remi Forax, <<a href="mailto:forax@univ-mlv.fr" target="_blank">forax@univ-mlv.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:#000000"><br><br><hr id="m_-4687842055251526081zwchr"><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"><b>From: </b>"Brian Goetz" <<a href="mailto:brian.goetz@oracle.com" target="_blank" rel="noreferrer">brian.goetz@oracle.com</a>><br><b>To: </b>"Florian Weimer" <<a href="mailto:fw@deneb.enyo.de" target="_blank" rel="noreferrer">fw@deneb.enyo.de</a>><br><b>Cc: </b>"amber-dev" <<a href="mailto:amber-dev@openjdk.org" target="_blank" rel="noreferrer">amber-dev@openjdk.org</a>><br><b>Sent: </b>Sunday, December 8, 2024 4:50:43 PM<br><b>Subject: </b>Re: Constructing records through reflection and module restrictions<br></blockquote></div><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"><font size="4" face="monospace">Sure, there are other ways we could
have designed the language. Tuples are structural types, which
means they are not declared, but instead spring when the type
constructor is applied to other (necessarily accessible) types.
This means there is no need for access control, since anyone who
can access T and U can "summon" the type `tuple<T,U>`. (We
have this for arrays already -- which is already a significant
source of irregularity in the language, so we chose not to emulate
that.)<br><br>
But, we chose to lean into Java's class-based, nominal type
system. Making special exceptions "because it's like a tuple" is
surely convenience in some cases, but makes the language more
complicated to reason about overall.</font></blockquote><br><div>We have made an exception for lambdas.<br></div><br><div>There is something special with tuples, most of my students now learn programming with Python as first langage, so there are used to use tuples as an element of design.<br></div><div>As an example, when students start Java, we have a course to explain that Java has no tuples and the difference between a record and a tuple.<br></div><br><div>Another example, currently, this is the time of the year where we are doing the advent of code, students can choose the langage they want, most of the undergraduate students choose Python.</div><div>When asked why, having tuples is the most cited feature, and it makes sense given the kind of problems of the advent of code.</div><br><div>I think we will have to fix this in Java at some point, not now, perhaps even not us, but exactly like we did not need lambdas because we had inner classes, not having tuples will be seen increasingly as a Java problem.<br></div><br><div>regards,<br></div><div>Rémi<br></div><br><div>NB: For graduate students, most of them are using Java for the advent of code, but i suppose this is a kind of Stockholm syndrome reaction because they are using Java in most of their courses (concurrency, android, http server, design pattern, spring, etc).<br></div><br><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"><font size="4" face="monospace"><br></font><br>
<br>
<div>On 12/8/2024 10:15 AM, Florian Weimer
wrote:<br>
</div>
<blockquote>
<pre>It's the syntactic overhead. The attractiveness of this pattern is
that's it's a clear and concise notation for this type of
deserialization. Creating a public type for it in a suitable package
sort of breaks that.</pre>
</blockquote>
</blockquote></div></div></div></blockquote></div><br></blockquote></div></div></body></html>