5 ms·
We had high hope that unlike SUN, Oracle will listen. > Iterative process please send a link to a video of a designer from Oracle presenting the string templa
by _old_dude_ 3y ago
We had high hope that unlike SUN, Oracle will listen.
> Iterative process
please send a link to a video of a designer from Oracle presenting the string templates at a conference. This is not Loom, there is no iterative process.
> Python, JS, and C# also don't allow for such a shortcut
The syntax of C# or Python is also lightweight, fine by me.
> it's not some special prefix
I get that, but not using a constant like STR is an anti-pattern, as you said it's a virtual method call.
> The criticism, on the other hand, seems to mostly come from people who have not actually tried it out
Ask designers to go to conferences and you will get real feedback.
- pron 3y ago> We had high hope that unlike SUN, Oracle will listen. Sorry to disappoint (or not) but much of the technical leadership are the same people... > please send a link to a video of a designer from Oracle presenting the string templates at a conference. How about not one video but two, not of any designer but of the chief language designer talking about the feature not at any conference but at what is probably the biggest Java conference? https://youtu.be/TIHx6MNt79Y?si=Qwj0ER-yxlS-Flxq&t=1972 https://youtu.be/TIHx6MNt79Y?si=Qwj0ER-yxlS-Flxq&t=1972 https://youtu.be/DlTUMjg7DD0?si=6urFyuyF_jCtZ0H-&t=1099 https://youtu.be/DlTUMjg7DD0?si=6urFyuyF_jCtZ0H-&t=1099 > This is not Loom, there is no iterative process a. you're wrong — the discussion and iteration have taken place on the amber-dev and the amber-spec-experts mailing lists — and b. I've received my share of accusations of "not listening" (and sometimes even worse) on Loom. It may not have been from you, though. :) As always, feedback that follows actual usage is taken very seriously and has a significant impact. You're right, however, that it's a much smaller feature than virtual threads, and so the public part of the design process didn't last for over four years but only for a little over two years (https://mail.openjdk.org/pipermail/amber-dev/2021-September/007076.html https://mail.openjdk.org/pipermail/amber-dev/2021-September/..., https://github.com/openjdk/amber-docs/blob/master/site/design-notes/templated-strings.md https://github.com/openjdk/amber-docs/blob/master/site/desig...). > The syntax of C# or Python is also lightweight, fine by me. Python has string interpolation but doesn't have string templates; Java has string templates but doesn't have string interpolation as a language feature. You're comparing syntax for two different features. As for C#, Java-like string templates can be mimicked [1], but the syntax isn't really lighter-weight. Instead of `SQL."SELECT * FROM SomeTable WHERE Age = \{age} AND Name = \{name}"` you'd write `SQL($"SELECT * FROM SomeTable WHERE Age = {age} AND Name = {name}")`; note that the method call to SQL is necessary to get a similar feature to Java's. > I get that, but not using a constant like STR is an anti-pattern, as you said it's a virtual method call. It's just a final field. You can do `final StringTemplate.Processor<String, RuntimeException> $ = STR;` and it's just as much of a "constant" as STR is. Of course, whether or not you should make string interpolation easier is up to you; after all, the reason we didn't add string interpolation to the language is because we think that making it easier is a bad idea given the vulnerabilities it has caused. > Ask designers to go to conferences and you will get real feedback. But they do. But just to clarify, feedback about a feature is from people who've actually used it; otherwise it's just a speculative opinion. [1]: https://bengribaudo.com/blog/2021/04/13/5596/intercepting-string-interpolation https://bengribaudo.com/blog/2021/04/13/5596/intercepting-st...