From mariusz.lotko at gmail.com Sun Dec 22 00:27:16 2024 From: mariusz.lotko at gmail.com (Mariusz Lotko) Date: Sun, 22 Dec 2024 01:27:16 +0100 Subject: String templates - JEP-459, JEP-465 Message-ID: Good evening, I read all three JEPs of String Templates and I'm a bit surprised that we need such a complicated feature. I bet that most Java developers simply _expects_? simple string interpolation, that they will be able to replace not-quite-readable string concatenations like: ??? "This is " + some.strange().callsWith("an argument") + " the end" with something like (I like JS version the most) ??? `This is ${some.strange().callsWith("an argument")} the end` or ??? ``` ??? This is the multilne version ?? ${some.strange().callsWith("an argument")} ?? the multiline end ?? ``` At compiler level that would be "simply" replace to old-good contatenation implementation which is StringBuilder calls. No security concerns (other than with current + operator), no (hidden) runtime penalties like the proposed FMT feature has to introduce. "String Templates" as language feature opened for externding by the libraries seem to me quite complicated. The benefit that we provide templates built into the language does not seem to be attractive - why should I use built-in templates instead of 3rd party Velocity/JTwig/whatever else? Best regards, Mariusz Lotko -------------- next part -------------- An HTML attachment was scrubbed... URL: