<html><body><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" <maurizio.cimadamore@oracle.com><br><b>To: </b>"Remi Forax" <forax@univ-mlv.fr>, "Gavin Bierman" <gavin.bierman@oracle.com><br><b>Cc: </b>"amber-spec-experts" <amber-spec-experts@openjdk.org><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></body></html>