3 ms·
I like the direction of just having the templates being a separate object that you can use as parameters to another method, it removes that extra syntax that wa
by TrianguloY 2y ago
I like the direction of just having the templates being a separate object that you can use as parameters to another method, it removes that extra syntax that was more python-oriented than java.
What I still don't like is the, apparently, automatic conversion of strings to templates? It's confusing because it's not clear in the new code how a template is identified. Just because it contains the \() part? But isn't one of the jep goals to allow apis to "allow Java libraries to define the formatting syntax used in string templates"? What if they used the backtick as a way to define a template? So that "abc \(f)" is a string but `abc \(f)` is a template?
This will force developers to explicitly choose which one to use, but since automatic conversion is rejected, I think this is what makes more sense (plus libraries can decide with overloading to admit one, the other, or both).