News for hackers. Stuff that matters.
Re:JEP 430: String Templates (Preview) Proposed to Target Ja... by lstamour on Friday March 03, 2023 @01:33PM (#35013344)
Yeah, the choice of \{ to create an expression instead of printing a literal { character is an odd one when you compare how you output a double-quote character:

> To aid refactoring, double-quote characters can be used inside embedded expressions without escaping them as \".

I would expect for consistency that \"{expression}\" outputs an expression and \"\{expression}\" would not.

Re:JEP 430: String Templates (Preview) Proposed to Target Ja... by kaba0 on Friday March 03, 2023 @04:46PM (#35015476)
Why would you have to escape ‘{‘?

I don’t get your examples. The JEP meant that they can be used inside not, in-between, so:

  \{ “a” + “b” + 3 }
could work.