<div dir="ltr">On Fri, Apr 21, 2023 at 12:27 AM Brian Goetz <<a href="mailto:brian.goetz@oracle.com">brian.goetz@oracle.com</a>> wrote:<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<font size="4"><font face="monospace">As I mentioned yesterday, the
high order bit here is how we describe a class whose
(null-restricted) instances can tolerate (and possibly even
encourage) uninitialized use, just as the primitives do today.</font></font> <br></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="4"><font face="monospace">
Ignoring the surface syntax, what we really need is an evocative
term for such a class.</font></font></div></blockquote><div><br></div><div>As a quick brainstorming options, what about the term "having immediate default"</div><div></div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="4"><font face="monospace">This term has to be useful and evocative
to multiple participants:<br>
<br></font></font></div></blockquote><div> </div><div><div>The word "immediate" can work in multiple contexts and evoke different associations.<br></div><div><br></div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="4"><font face="monospace"> <font size="4"><font face="monospace">- The client of a class, who may exploit the fact that
instances may be safely used uninitialized, or who may want to
reason about flattening.</font></font></font></font> <br></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="4"><font face="monospace"><font size="4"><font face="monospace"> <font size="4"><font face="monospace">- The specification / descriptive documents, which will need a
way to talk about "classes that are friendly to uninitialized
use." </font></font></font></font></font></font></div></blockquote><div> </div><div><br></div><div>"Immediate" can mean that the default value is immediately available and can be used without initialization. A declared field immediately has a usable value. A declared array immediately has elements, without the need to initialize them. Having values immediately allows them to be efficiently packed (flattened).</div><div><br></div><div>"Immediate" can also mean ease of construction. A class with "immediate default" can be constructed very easily using `T.default` notation or `new T()` constructor without arguments. This expression that allows you to construct an instance of the class is very small and obvious, so it's very fast to write it, so you get a new instance almost immediately.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="4"><font face="monospace"><font size="4"><font face="monospace"> </font></font>- The author of a class, who is making a decision about whether
the zero state represents a sensible default. <br></font></font></div></blockquote><div><br></div><div>For the author of the class, the word "immediate" can mean that the default value is obvious, i. e. you can immediately see what it is, the meaning of all zeroes is immediately clear without further explanation.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="4"><font face="monospace">
This concept is made more difficult because this property will
only have observable effects for variables with null-restricted
types. <br>
<br></font></font></div></blockquote><div><br></div><div>"Having immediate default" serves in this way to say that nothing special is actively happening with such value classes, but if the default value is needed for the class, then it is immediately available,<br></div><div><br></div><div>Hope this may be useful.</div><div><br></div><div>--</div><div>Victor Nazarov<br></div></div></div>