<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Given this is a spec issue, I think it should be discussed on the spec-experts list,<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>"Brian Goetz" <brian.goetz@oracle.com><br><b>To: </b>"Bas Leijdekkers" <bas.leijdekkers@jetbrains.com>, "amber-dev" <amber-dev@openjdk.org><br><b>Sent: </b>Friday, September 15, 2023 5:17:53 PM<br><b>Subject: </b>Re: String Templates Expression Statement<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;"><font size="4"><font face="monospace">We have gone back and forth on
this, but I believe we are better served by not allowing string
templates as statement expressions. A string template is
supposed to _produce something_, not _operate by side effects_.
A statement expression serves only to normalize its use to
produce side effects. </font></font></blockquote><div><br></div><div><div>A string template is a value, it does not produce anything. So I suppose you mean a String template "processor" is supposed to produce something.</div><div><br data-mce-bogus="1"></div></div><div>And for the record, the reason we are giong back and forth is that restricting the syntax to only support expression does not fit well with the fact that a processor is specified as an interface.</div><div>So we are allowing the definition of a processor to have states but we are disallowing the syntax that calls a processor to modify those states.</div><div><br data-mce-bogus="1"></div><div>Personnally, I can leave with that, the Java semantics is full of this kind of special cases.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>And if someone really want a processor to acts as builder in the generic sense, the syntax<br data-mce-bogus="1"></div><div> var _ = processor."...";<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>works anyway.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>RĂ©mi<br data-mce-bogus="1"></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;"><br>
<br>
<div class="moz-cite-prefix">On 7/12/2023 7:26 AM, Bas Leijdekkers
wrote:<br>
</div>
<blockquote cite="mid:CAC=TH2b-K4-vK9ngNkjSXyT4AK1NNKtq0kUv5wkbTev6-7eRPA@mail.gmail.com">
<div dir="ltr">Hello Amber-dev,
<div><br>
</div>
<div>In the String Templates draft specification, I don't see
any changes in JLS Chapter 14.8 Expression Statements. This
makes me think that Template Expressions are not allowed to be
used as statements. However javac in jdk21-ea accepts a
Template Expression used as a statement without reporting any
error. (I am using build 21-ea+30-2426). So it appears to me
either the specification or javac is incorrect. Which one
should I believe?</div>
<div><br>
</div>
<div>Example code:</div>
<div>```</div>
<div>class TemplateExpressionStatement {<br>
public static void main(String[] args) {<br>
STR."\{}";<br>
}<br>
}<br>
</div>
<div>```</div>
<div><br>
</div>
<div>Bas</div>
</div>
</blockquote>
<br><br></blockquote></div></div></body></html>