New candidate JEP: 430: String Templates (Preview)

forax at univ-mlv.fr forax at univ-mlv.fr
Wed Sep 21 12:55:21 UTC 2022


----- Original Message -----
> From: "Brian Goetz" <brian.goetz at oracle.com>
> To: "Remi Forax" <forax at univ-mlv.fr>, "amber-dev" <amber-dev at openjdk.org>
> Cc: "jdk-dev" <jdk-dev at openjdk.org>
> Sent: Tuesday, September 20, 2022 10:11:16 PM
> Subject: Re: New candidate JEP: 430: String Templates (Preview)

>> Hi all.
>> My main concern is that the TemplatedString object erase the types, but apart
>> trivial template processors, those types is either required or can be used in
>> order to be more efficient.
> 
> While the types may be erased to Object[], the dynamic types are
> available to template processors.  So processors that "require" types
> have no problem, they just have to use `instanceof` and similar.  As to
> performance, yes, we would like a path to making user-written processors
> as efficient as we are able to make the JDK ones, but we've chosen to
> come back for that in a later round if need be.  The semantics are in
> place; we can make it more efficient later.  Java developers have waited
> a long time already for this functionality, and I don't want to delay it
> further just so we can make the advanced cases more efficient.

It's not just about efficiency, it's about loosing type informations.
Imagine that the we have a SQL update processor that create the BD table if it does not exist when updating it,
because the type are erased, the information of the types of the table columns is lost.

Rémi


More information about the jdk-dev mailing list