<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body dir="auto">
I’ve mentioned this previously, while not impossible it is difficult to switch simply because the context of detecting processor dot is at the parser level, where the detection of \{ is at the lexer/tokenization level.
<div><br>
</div>
<div>There is a big plus for not following the herd with ${, you can embed other languages such as JavaScript without fear of conflict. \{ also doesn’t conflict with existing templating libraries. </div>
<div><br>
</div>
<div>In a previous email, I demonstrated how you could use your own style StringTemplates using ${. </div>
<div><br>
</div>
<div>
<blockquote type="cite">
<div dir="ltr">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Note that there is a very strong backlash against the backslash (play on words intended) in the Java community.</span></p>
</div>
</div>
</blockquote>
<div><br>
</div>
Depends on who you hang out with. I know the Swift crowd seem content with \(. Not sure I see the point of making all languages the same. </div>
<div><br>
</div>
<div>Like any new language feature, you do get use to \{. Once IDEs integrate, string templates will become second nature. </div>
<div><br>
</div>
<div>Cheers,</div>
<div><br>
</div>
<div>— Jim<br>
<br>
<div dir="ltr">📱</div>
<div dir="ltr"><br>
<blockquote type="cite">On May 13, 2023, at 11:22 AM, interlink.sg7@gmail.com wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style>@font-face { font-family: "Cambria Math"; }
@font-face { font-family: "Yu Gothic"; }
@font-face { font-family: Calibri; }
@font-face { font-family: "Yu Gothic"; }
p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif; }
span.E-MailFormatvorlage17 { font-family: Calibri, sans-serif; color: windowtext; }
.MsoChpDefault { }
@page WordSection1 { size: 612pt 792pt; margin: 99.25pt 3cm 3cm; }
div.WordSection1 { page: WordSection1; }</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="DE">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I tried out the early-access build of JDK 21 and saw that the TemplateProcessor seems to be mandatory now for String Templates:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> var hello = "Hello \{name}"; ==> error: processor missing from template expression<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The JEP says: "Thus if we forget to use a template processor such as STR, RAW, or FMT then a compile-time error is reported".<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I know you dread this kind of discussion, but if that is the case, would we now be able to reconsider ${…}?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The original reason behind \{…} was to avoid conflicts with legacy code.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Using ${…} would require a tag on string templates (either a prefix or a delimiter other than "). See Alternatives section in the JEP.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">However if the TemplateProcessor . TemplateArgument is mandatory it kinda acts as a tag anyway?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Backwards compatibility is still ensured as far as I can tell.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Note that there is a very strong backlash against the backslash (play on words intended) in the Java community.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Kind regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Simon<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</div>
</blockquote>
</div>
</body>
</html>