<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body><div style="font-family: sans-serif;"><div class="markdown" style="white-space: normal;">
<p dir="auto">On 1 Jul 2022, at 5:39, Brian Goetz wrote:</p>
</div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;"><p dir="auto">Now that the model is settling, the messages in the suggestion box --
<br>
many of them syntax-driven --
<br>
are coming fast and furious now. Here's another.</p>
<p dir="auto"> Summary: "Having to type .val will make users angry; can we please find a way to make it the default at least sometimes."</p>
</blockquote></div>
<div class="markdown" style="white-space: normal;">
<p dir="auto">Having to guess the name of the value companion type will make<br>
a different set of users angry (including me). Also the<br>
spec-writers and teachers will lose a useful tool.</p>
<p dir="auto">My take: Start with a standard (dumb but effective) name<br>
like <code style="margin: 0; padding: 0 0.4em; border-radius: 3px; background-color: #F7F7F7;">C.val</code> for “the value companion for class <code style="margin: 0; padding: 0 0.4em; border-radius: 3px; background-color: #F7F7F7;">C</code>”. Live<br>
with its boring but useful predictability for a while.<br>
Later, add some sort of separable “type alias” mechanism<br>
that polishes not just this one flyspeck but cleans up a<br>
whole raft of naming issues. There are no shortages of<br>
examples Java might follow in this area.</p>
<p dir="auto">Another take: There is a basic difference between use-site<br>
and def-site declarations, and type aliases can (and should?)<br>
go on both sides. But it is natural and easy to put them<br>
on the use-site first, perhaps an “import … as …” thing.<br>
Then maybe something that feels like a type-member, but is<br>
also an alias. Remember that type-members are easy to<br>
import, if you want to use their unqualified names.</p>
<p dir="auto">Yet one more take: Compiling alternative type names into<br>
class file linkage is a losing proposition. Let’s not.<br>
This is another reason to embrace <code style="margin: 0; padding: 0 0.4em; border-radius: 3px; background-color: #F7F7F7;">C.val</code> and the JVM’s<br>
Q-descriptors, instead of some complicated landscape of<br>
mapping tables that will be endlessly out of date.<br>
Type aliases need to be canonicalized at javac-time.</p>
<p dir="auto">Final thought: Notice that we don’t really need to do<br>
anything about this immediately; the type alias idea<br>
will keep. Let’s table it; we have enough to worry about.</p>
</div></div></body>
</html>