String Templates: syntax question

Eran Leshem eran at leshem.life
Sun Nov 12 21:42:15 UTC 2023


Hello,

 

I'm delighted by the addition of String Templates to Java! 

 

I have a question about the syntax. The Alternatives section of the JEP
gives great answers to most questions, but I was left with this one:

Why is the backslash needed? In most languages, as you nicely listed, string
templates are marked with either a template prefix or an embedded expression
prefix. Why does Java require both the "<processor>." template prefix and
the "\" embedded expression prefix? 

 

The Ensuring Safety section implies that the backslash's goal is to enable
the detection of string templates with missing processors. Did I read that
correctly? If so, I'd suggest documenting that explicitly. In addition, I'd
like to raise the question whether the extra ceremony is warranted by that
goal.

 

Thanks 

Eran

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20231112/010dc719/attachment-0001.htm>


More information about the amber-dev mailing list