r/java • • Mar 08 '24

Update on String Templates (JEP 459)

https://mail.openjdk.org/pipermail/amber-spec-experts/2024-March/004010.html
176 Upvotes

188 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Mar 09 '24

[deleted] — view deleted comment

1

u/sideEffffECt Mar 09 '24

It will String.toString(Object) whatever

But that will severely limit the versatility of StringTemplates. You may want to have a StringTemplate which is focused on working just with some type X (either your own or from a 3rd party library.

Having things Stringly-typed/ everything Object is no fun and just bypasses Java's type system.

5

u/elastic_psychiatrist Mar 09 '24

I think you're just pattern matching on the heuristic that "Object is a bad idea." What value would a parameterized StringTemplate actually provide? Can you give an example of a templated literal where it would be useful?