<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>"Brian Goetz" <brian.goetz@oracle.com><br><b>To: </b>"Florian Weimer" <fw@deneb.enyo.de><br><b>Cc: </b>"amber-dev" <amber-dev@openjdk.org><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 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;"><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><div><br></div><div>We have made an exception for lambdas.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><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 data-mce-bogus="1"></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 data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><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><div><br data-mce-bogus="1"></div><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 data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>regards,<br data-mce-bogus="1"></div><div>RĂ©mi<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><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 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;"><font size="4" face="monospace"><br></font><br>
<br>
<div class="moz-cite-prefix">On 12/8/2024 10:15 AM, Florian Weimer
wrote:<br>
</div>
<blockquote cite="mid:87v7vufbog.fsf@mid.deneb.enyo.de">
<pre class="moz-quote-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>
<br><br></blockquote></div></div></body></html>