Third draft spec for String Templates (JEP 430) now available

Alex Buckley alex.buckley at oracle.com
Tue Feb 28 18:37:04 UTC 2023


1. Escape sequences are legal in fragments, so 3.10.7 should open with 
something like:

"In character literals, string literals, and text blocks (§3.10.4, 
§3.10.5, §3.10.6), +and in fragments of a template (3.13),+ the escape 
sequences allow for ..."


2. 3.10.7 goes on to say that "An escape sequence in the content of a 
character literal, string literal, or text block is interpreted by ...". 
This statement constitutes one half of a two-part exposition of 
interpretation, the other half being found in 3.10.4/5/6 where 
`String.translateEscapes` is mentioned. Two-way exposition is hard to 
write, expensive to maintain, but helpful to read. 3.13 is upfront that 
StringTemplateBegin, StringTemplateMid, and StringTemplateEnd tokens 
enjoy interpretation, so let's get them named in 3.10.7. 3.13 is less 
upfront about TextBlockTemplateBegin, TextBlockTemplateMid, and 
TextBlockTemplateEnd tokens, let me set them aside for now.


3. 3.10.7 should end with a note that the character sequence \{ is not 
an escape sequence but rather has meaning in a template (3.13).


4. In 3.13, consider "A fragment ~consists of~ +represents+ a 
non-expression part of a template."  (Ch.3 is big on "representing", or 
perhaps "denoting", things.)  This sentence would work well in the 
opening paragraph of the section.


5. 15.8.6 needs more polishing, per the mail I sent about it last time. 
I'll discuss offline.

Alex

On 2/28/2023 8:15 AM, Gavin Bierman wrote:
> Following the feedback, a small update of the String Templates Spec is 
> now available:
> 
> https://cr.openjdk.org/~gbierman/jep430/jep430-20230222/specs/string-templates-jls.html <https://cr.openjdk.org/~gbierman/jep430/jep430-20230222/specs/string-templates-jls.html>
> 
> Any further comments welcomed!
> 
> Thanks,
> Gavin
> 
> 
>> On 9 Feb 2023, at 15:28, Gavin Bierman <gavin.bierman at oracle.com 
>> <mailto:gavin.bierman at oracle.com>> wrote:
>>
>> Dear experts:
>>
>> A new, updated spec covering JEP 430 (String Templates) is now 
>> available at:
>>
>> https://cr.openjdk.java.net/~gbierman/jep430/latest 
>> <https://cr.openjdk.java.net/~gbierman/jep430/latest>
>>
>> This is a substantial rewrite: it now covers more fully how templates 
>> are tokenized, how to deal with ambiguities, and how text block 
>> templates are dealt with.
>>
>> Comments welcomed!
>> Gavin
> 


More information about the amber-spec-observers mailing list