by MBCook · 3y ago · 0 comments
Unlike many here I do like the choice of \{}, although personally I would have preferred \() like Swift.
I can’t wait.
Since class names start with a capital it fits. At least I think that was the reasoning they stated.
Why not Str? Perhaps they thought this would be less likely in existing code. I’m not sure I don’t think they mentioned the reason.
They could have also just put it on the String class. Again I didn’t see a discussion as to why that wasn’t suggested.
String.”Hello, \{name}.”
Seems like it would have been reasonable. But this is a proposal so it may change before officially joining the JDK.
StringTemplate t = RAW.”Hello, \{name}.”
STR.process(t);The syntactic sugar should be a feature then used used here rather than invent a special cased syntax for a feature
just use a conventional calling syntax. Java is a fairly verbose language with a highly verbose popular patterns
final var str = STR;