<div dir="ltr"><div>My opinion only of course, but I think this would be a step backwards.</div><div><br></div><div>You would be adding an extra level of mental redirection that a developer would have to go through every time they see "String".</div><div><br></div><div>Now sometimes the cost of a level of indirection is worthwhile .. for example, using "import java.util.List" means in exchange for that extra level of redirection, we can say "List" instead of "java.util.List". So import statements are a worthwhile trade-off. Helping the cause, it's rare that I would ever declare a class named "List" in the unnamed package, and I haven't used AWT in 20 years, so these days when I see "List" there's not much ambiguity.</div><div><br></div><div>But "String" is used everywhere. And yet we are only talking about saving a single character (what I love about the nullity syntax idea is that in a single character, so much information that I need constantly, all over the place, is being conveyed). So the trade-off doesn't seem worth it.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">There’s clarity in only being allowed to use 1 type of punctuation in a class.</blockquote><div><br></div><div>Hmm, I actually feel the opposite. Most code is write once, read many, so you want to optimize for the reading of it, not the writing of it.</div><div><br></div><div>-Archie</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Apr 10, 2025 at 8:54 AM Jonathan F <<a href="mailto:livedinsquares@gmail.com">livedinsquares@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div id="m_-2602859374067395306bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;margin:0px">It seems the syntax of nullable types is extra-important for its usability, so here’s an idea which perhaps the EG hasn’t considered. Remi has mentioned a 2-states model? - maybe this is different:<br></div><div><br></div><div>- Assume there’s some way (any way) to specify default nullability within some scope: to set either that String means String!, or that it means String?. If you don’t specify anything, as now, String means unspecified null.</div><div><br></div><div>- Then: if you set default nullability to ! , you’re allowed to write String or String? but not String! (i.e. you can’t belabour the non-nullability of a particular String)</div><div><br></div><div>- Likewise if you set default nullability to ? , you’re allowed to write String or String! but not String?. Or maybe we don’t even need this default.</div><div><br></div><div>- (I think…) if you don’t set a default so it's 'unspecified null’ (as now), then neither String? nor String! is allowed: they force you to set a default.</div><div><br></div><div><br></div><div>The point of this is:<br></div><div><br></div><div>- There’s clarity in only being allowed to use 1 type of punctuation in a class. And seeing it tells you there’s a default.</div><div><br></div><div>- If you see ? or ! in a sample of code you’ll know what a bare String means: ’the opposite'.</div><div><br></div><div>- Pasting raw code between two classes with different nullability will often give compile errors from mixed punctuation (unless your IDE adjusts the code, which hopefully IDEs will).</div><div><br></div><div>- This fits with simple ways to convert an existing class to being null-aware: set the default to !, so existing types are reinterpreted as null-restricted, then fix errors by adding ? piecemeal. But if you want to make minimal changes you may want to set the default to ? instead, then add ! piecemeal; or again maybe we don’t need that default - even simpler.<br></div><div><br></div><div>As for actually using ‘unspecified null’ (which I hope will be rare in null-aware code) - maybe String* or even String!? is OK.</div><div><br></div><div>I hope that (or something like it) makes sense.</div><div><br></div><div>Jonathan<br></div><div><br></div><div>Jonathan Finn</div><div><br></div>
</blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div>