<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <font size="4" face="monospace">The comparison to C# may be
      syntactically short, but is pretty different culturally.  The
      block of a C# `with` expression is restricted to _property
      assignments_.  There, they are aligning the `with` syntax to the
      "initialization by properties" that they already had.  So this
      makes total sense in C#, because doing it differently would be a
      glaring difference.  You could describe this comparison as "C# did
      it this way to put the last block in the wall, but in Java, this
      would be the first block."  <br>
      <br>
      In any case, we're deeply in danger of doing the thing that we're
      not supposed to do here, which is:<br>
      <br>
       - Gavin posts a document for review<br>
       - A completely tangential observation hijacks the discussion<br>
      <br>
      Your point is: "users may try to abuse withers to get another
      feature that they want", and we should be mindful of that.  Point
      taken, but I think this discussion has played out.<br>
      <br>
    </font><br>
    <div class="moz-cite-prefix">On 1/25/2024 8:13 AM, <a class="moz-txt-link-abbreviated" href="mailto:forax@univ-mlv.fr">forax@univ-mlv.fr</a>
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:894149300.112135100.1706188402504.JavaMail.zimbra@univ-eiffel.fr">
      
      <div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000">
        <div><br>
        </div>
        <div><br>
        </div>
        <hr id="zwchr" data-marker="__DIVIDER__">
        <div data-marker="__HEADERS__">
          <blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From:
            </b>"Maurizio Cimadamore"
            <a class="moz-txt-link-rfc2396E" href="mailto:maurizio.cimadamore@oracle.com"><maurizio.cimadamore@oracle.com></a><br>
            <b>To: </b>"Remi Forax" <a class="moz-txt-link-rfc2396E" href="mailto:forax@univ-mlv.fr"><forax@univ-mlv.fr></a>, "Gavin
            Bierman" <a class="moz-txt-link-rfc2396E" href="mailto:gavin.bierman@oracle.com"><gavin.bierman@oracle.com></a><br>
            <b>Cc: </b>"amber-spec-experts"
            <a class="moz-txt-link-rfc2396E" href="mailto:amber-spec-experts@openjdk.org"><amber-spec-experts@openjdk.org></a><br>
            <b>Sent: </b>Thursday, January 25, 2024 1:41:57 PM<br>
            <b>Subject: </b>Re: Draft JEP: Derived Record Creation
            (Preview)<br>
          </blockquote>
        </div>
        <div data-marker="__QUOTED_TEXT__">
          <blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">
            <p>Looking from another angle, I think an important
              distinction between creation and _derived_ creation is
              that in the latter case you have some "fallback" values to
              use if the `with` block doesn't specify transforms for all
              of them. In the plain creation case, since the object did
              not exist before, there is nothing to fall back to - other
              than the default value of course, which might be a
              surprising/lousy choice in some cases. So perhaps the
              similarity between these two cases is more superficial
              than it looks.</p>
          </blockquote>
          <div><br>
          </div>
          <div>Let's take a look to the cousins of Java that have a
            syntax equivalent to the derived record creation. As far as
            i know, we have C# and Rust / Javascript.<br data-mce-bogus="1">
          </div>
          <div><br data-mce-bogus="1">
          </div>
          <div>In the case of C#, the syntax is very similar to the one
            proposed for Java, but the block of code uses '',' instead
            of ';' (*).</div>
          <div>  point with { x = 3,  y = 4 }<br data-mce-bogus="1">
          </div>
          <div>The syntax for creating and initializing an object in C#
            is new Point { x = 3,  y = 4 }.<br data-mce-bogus="1">
          </div>
          <div>As you can see the syntax is very similar.<br data-mce-bogus="1">
          </div>
          <div><br data-mce-bogus="1">
          </div>
          <div>In the case of Rust (or Javascript), the syntax uses a
            splat/spread operator at the end of the object
            initialization syntax,</div>
          <div>  Point {<br data-mce-bogus="1">
          </div>
          <div>    x: 3,<br data-mce-bogus="1">
          </div>
          <div>    y: 4,<br data-mce-bogus="1">
          </div>
          <div>    ..point  // spread operator<br data-mce-bogus="1">
          </div>
          <div>  }<br data-mce-bogus="1">
          </div>
          <div><br data-mce-bogus="1">
          </div>
          <div>In all cases, the same syntax is used for the creation
            and the derived creation. As you said, the semantics is
            slighly different but in an obvious way, the creation an
            object requires all components to be initialized, the
            derived creation don't.<br data-mce-bogus="1">
          </div>
          <div><br data-mce-bogus="1">
          </div>
          <div>regards,<br data-mce-bogus="1">
          </div>
          <div>RĂ©mi</div>
          <div><br data-mce-bogus="1">
          </div>
          <div>(*) given that the transformation block is just code in
            Java, it makes sense to use '=' and ';', given those are
            just variable assignments.</div>
          <div><br data-mce-bogus="1">
          </div>
          <blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">
            <p><br>
            </p>
            <p>Maurizio<br>
            </p>
            <div class="moz-cite-prefix">On 24/01/2024 20:19, Remi Forax
              wrote:<br>
            </div>
            <blockquote cite="mid:747149434.111514854.1706127578940.JavaMail.zimbra@univ-eiffel.fr">
              <pre>And as a general remarks, I hope there will be a following JEP about 
record instance creation that allows to use the syntax of a 
transformation block to initialize a record.</pre>
            </blockquote>
            <br>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>