Java could do the same to change the behaviour of `$` inside a string (along with a project-level config to make this the default).
Let developers opt-in to better syntax, rather than using significantly worse syntax to support legacy code
https://learn.microsoft.com/en-us/dotnet/csharp/nullable-mig...
STR."\{STR."""
\{hey}
"""}"Every other language is susceptible to SQL injection style attacks. Not Java specific.
Elixir has string interpolation and custom "templates" or whatever they are called without the ugly syntax:
~h"custom one"
~s"custom two"
etc.If the string template is prefixed by a processor STR."foo" instead of "foo" then you do not need \{variable} instead of $variable.
And editors will use different colors.
Using \ or $ is not about backward compatibility but about ergonomics.
Much easier to accidentally write something that boils down to
"\{bobby}"
where it should have been SQL."\{bobby}"
than STR."\{bobby}"
instead of SQL."\{bobby}"
(i admit that this argument would work better if STR was typographically more different from the name you'd inevitably use for an SQL statement processor)