<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Hi,<br>
<br>
In addition, changing from null allowed to null-restricted in APIs
would be an incompatible change.<br>
So existing uses would not be changed.<br>
<br>
It would be advisable (as always) in new APIs to be very specific
about the meaning of null; throwing or allowed.<br>
As currently specified, there is no clean Duration value that could
be used as a sentinel (alternative to null) except in a some
application specific use.<br>
<br>
Happy New Year, Roger<br>
<br>
<div class="moz-cite-prefix">On 12/29/24 2:48 PM, Glavo wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAJL5A3m7OgWAAmUj_d70TBwQAhoczrQT2QSh0z1htpnVL4J6-Q@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Hi Jean-Noël,
<div><br>
</div>
<div>From what I understand,
the null-restricted types
are use-site specified,
which means that
`Duration` is not
null-restricted, but
`Duration!` is
null-restricted, even
though it is a value
class.</div>
<div><br>
</div>
<div>It is also worth noting
that null-restricted types
are not a requirement for
flattening value objects.</div>
<div>For a variable of a
nullable value type,
Valhalla may use a "null
channel" to distinguish
between null and non-null
values.</div>
<div>The null channel could
be a boolean variable or
something else, you can
read this article[1] to
learn more about it.</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div><br>
</div>
<div>Glavo</div>
<div><br>
</div>
<div>[1]: <a href="https://cr.openjdk.org/~jrose/values/flattened-values.html" moz-do-not-send="true" class="moz-txt-link-freetext">https://cr.openjdk.org/~jrose/values/flattened-values.html</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote gmail_quote_container">
<div dir="ltr" class="gmail_attr">On Mon, Dec 30, 2024 at
12:49 AM Jean-Noël Rouvignac <<a href="mailto:jean-noel.rouvignac@pingidentity.com" moz-do-not-send="true" class="moz-txt-link-freetext">jean-noel.rouvignac@pingidentity.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 dir="auto">Hello,
<div dir="auto"><br>
</div>
<div dir="auto">I have a use case for configuration objects
where I would like to use java.time.Duration to represent
time intervals, timeouts, delays, etc. for example.</div>
<div dir="auto"><br>
</div>
<div dir="auto">In these configuration objects, sometimes
users may not provide a value, and the configuration
framework does not have a default value for it either.
This is to be interpreted as "disable the feature" or "let
the library decide". For this specific case, I was
considering returning `null` to mean "disable the feature"
or "let the library decide".</div>
<div dir="auto"><br>
</div>
<div dir="auto">java.time.Duration being marked as a value
based class, I wanted to confirm that using `null` will
not force significant rework in the future? i.e.
java.time.Duration will not opt-in to become a
null-restricted value class type (<a href="https://openjdk.org/jeps/8316779" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://openjdk.org/jeps/8316779</a>).</div>
<div dir="auto"><br>
</div>
<div dir="auto">Thanks a lot, and thanks for the huge work
on Valhalla. Good luck for bringing it into mainline Java
!</div>
<div dir="auto"><br>
</div>
<div dir="auto">Jean-Noël </div>
</div>
<br>
<i style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background:rgb(255,255,255);font-family:proxima-nova-zendesk,system-ui,-apple-system,system-ui,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",Arial,sans-serif;color:rgb(85,85,85)"><span style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background:transparent;font-family:proxima-nova-zendesk,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",Arial,sans-serif;font-weight:600"><font size="2">CONFIDENTIALITY NOTICE: This email may contain
confidential and privileged material for the sole use of
the intended recipient(s). Any review, use, distribution
or disclosure by others is strictly prohibited. If you
have received this communication in error, please notify
the sender immediately by e-mail and delete the message
and any file attachments from your computer. Thank you.</font></span></i></blockquote>
</div>
</blockquote>
<br>
</body>
</html>