Each time i re-read this JEP, i'm more and more sorry about its state. 
- we are breaking how Strings worked, now everything in between "..." is not a 
String anymore. 
As an example, given a String s, only one of the following lines compiles 
System.out.println("s = \{s}".toUpperCase()); 
System.out.println("s = {\s}".toUpperCase()); 
- conceptually we have something like 
instance -> template -> arguments 

but instead of grouping it like this 
Class.apply(template).invoke(instance, arguments) 

the JEP groups them like this 
instance.apply(new TemplatedString(template, arguments)) 

which is far less efficient because both the class and the template are 
constants while the instance and the arguments are not. 

Rémi 

> From: "Jim Laskey" <james.las...@oracle.com>
> To: "core-libs-dev" <core-libs-...@openjdk.java.net>
> Sent: Tuesday, October 25, 2022 6:41:05 PM
> Subject: RFR - Implementation of JEP-430 String Templates (Preview) CSR

> Request for a broader review of the String Template APIs for JEP 430.

> Summary:

> Enhance the Java programming language with string templates, which are similar
> to string literals but contain embedded expressions. A string template is
> interpreted at run time by replacing each expression with the result of
> evaluating that expression, possibly after further validation and
> transformation. This is a preview language feature and API.

> CSR: [ https://bugs.openjdk.org/browse/JDK-8286021 |
> https://bugs.openjdk.org/browse/JDK-8286021 ]
> JEP: [ https://openjdk.org/jeps/430 | https://openjdk.org/jeps/430 ]

> Thank you.

> — Jim

Reply via email to