<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <br>
    <br>
    <div class="moz-cite-prefix">On 15/04/2025 17:17, Adam Gent wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:7f0069a3-e645-4683-b7ec-99047fa885ca@app.fastmail.com"><span style="white-space: pre-wrap">
</span>
      <pre class="moz-quote-pre" wrap="">
For those that do not want to go to reddit the gist is I think if we do not allow null in a Scoped Value it makes the API less bloated and easier to use with pattern matching. </pre>
    </blockquote>
    Just to add to Andrew's comments.  If you think of a scoped value an
    implicit parameter then it would be surprising to allow an explicit
    parameter be null but not an implicit parameter. As it happens, the
    first usage of ScopedValue API was Subject which does bind to a null
    value. In any case, as Andrew said, once we have null-restricted
    types then a nullness marker can be used. The orElse(V) method
    doesn't allow null so it might become orElse(V!). There may be an
    argument to add an orNull() for cases where code wants to gracefully
    handle the case that it is called without a binding and not use a
    sentinel, that hasn't been ruled out.<br>
    <br>
    -Alan<br>
  </body>
</html>