<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <font face="monospace" size="4">While I would not say that the `x
      with B` syntax is written in stone, I don't think just stapling
      `new` to it is helpful.  I will point out (as I have several times
      before) that I think trying to coerce the `with` syntax into a way
      to get by-name invocation of constructors is a very bad move.  I
      totally get why people keep reaching for it, but it's the wrong
      way to get there.  Maybe we'll get there some other way, maybe we
      won't, but we definitely won't get there this way.</font><br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 11/20/2024 11:46 AM, Olexandr Rotan
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAL5bRt81LmXEqZ=bK+h2Ek7nfr2VXi=ggbZAZXCriZanDLpWQw@mail.gmail.com">
      
      <p dir="ltr">Yea, Brian, I agree with you. I wasn't even proposing
        that as argument against proposal, more like a nasty little
        detail, hence this is a "side note". Moreover, if (or, I hope,
        when) more record features expanded to all classes, compiler
        will still be required to clone non-value objects since they can
        be mutable, and with implies making a copy (although not always
        actually has to do it as in my example).</p>
      <p dir="ltr">But I gave more thought to this today, and what I
        have concluded is that I would rather vote against it. The
        reason is that only value that "new" brings to the table here is
        better "human readability". But, for me it seems more like a
        mumbling. I am, I guess, more of a writablity guy than most
        people here, so I don't really like mumbling. Also it is some
        noise for reader. "New" here does not help resolve some
        ambiguity nor for compiler nor for reader, at least as it seems
        for me. That's why I would say I am not a fan of this syntax</p>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Nov 20, 2024, 15:18
          Brian Goetz <<a href="mailto:brian.goetz@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">brian.goetz@oracle.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
          > Hello. Just a side note: AFAIK "new", by spec, guarantees
          that new <br>
          > instance of object is returned<br>
          ><br>
          <br>
          Historically this is true.  However, when Valhalla gives us
          value types, <br>
          the "new"-ness of a new value object will be indistinguishable
          from an <br>
          old object.  So I would advise against taking this "new means
          new" <br>
          dictum too literally.<br>
          <br>
          > , so it can potentially affect implementation
          requirements for <br>
          > compilers, forcing them to copy records even if with
          expression block <br>
          > is empty, i.e.<br>
          ><br>
          > var b = new a with {}<br>
          ><br>
          > Unless there is a exception for such syntax, new will
          mandate that b <br>
          > != a (by reference)<br>
          ><br>
          <br>
          ... unless a and b are value objects, in which case ==
          compares their <br>
          state, not their identity (because they have none.)<br>
          <br>
          <br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>