Try it out. The code has been sitting in the amber repo on the 
templated-strings branch all along.

Cheers,

— Jim


📱

On Oct 27, 2022, at 6:20 PM, Remi Forax <fo...@univ-mlv.fr> wrote:


I would like to retract the comments i've made below,
because the first point is now moot and for the second one, after some more 
thinking, it may be not that bad and at least the API is very simple to use.

Rémi

________________________________
From: "Remi Forax" <fo...@univ-mlv.fr>
To: "Jim Laskey" <james.las...@oracle.com>
Cc: "core-libs-dev" <core-libs-...@openjdk.java.net>
Sent: Wednesday, October 26, 2022 11:25:58 AM
Subject: Re: RFR -  Implementation of JEP-430 String Templates (Preview) CSR
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
JEP: https://openjdk.org/jeps/430


Thank you.

— Jim



Reply via email to