On Wed, 9 Nov 2022 23:48:57 GMT, Jim Laskey <jlas...@openjdk.org> wrote:

>> 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](http://openjdk.java.net/jeps/12).
>
> Jim Laskey has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Switch from anonymous classes  to carrier based StringTemplate 
> implementation

Interesting few days. Several reviewers have asked that I don't use anonymous 
classes to implement string templates; concern about producing lots of little 
classes. I dusted off the carrier code that I abandoned as non-performant and 
came up with an idea to make carriers faster (remove a level of indirection). 
The result is we can now use carriers for compiler generated string templates 
which can interpolate as fast as the anonymous classes and string 
concatenation. Now there is only two classes representing compiler generated 
string templates; one carrier based and one generic array based used when the 
number of values exceed method max arg count.  Along with this change is some 
significant clean up of the organization; more in line with other systems in 
the JDK.

Most of the files related to templates are now in java.lang.template (moved 
from jdk.internal). java.lang.template.TemplateSupport containing the template 
bootstrap methods is renamed to TemplateRuntime and moved to java.lang.runtime 
along with the other java.lang bootstrap classes. 
java.lang.template.TemplateRuntime is renamed to TemplateSupport to be more in 
line with what it represents.

Three new files, java.lang.template.Carriers, 
java.lang.template.ReferencedKeyMap and java.lang.template.ReferenceKey, have 
been added to support carriers.

I've integrated almost all your recommendations. Thank you for your reviews. 
Keep them coming. I hope this is the last major change required before preview.

-------------

PR: https://git.openjdk.org/jdk/pull/10889

Reply via email to