4 ms·
Yes, because it's the escape character. It's the reason they didn't chose "${" like many other languages. Because that's a valid sequence in a string literal.
by ahtihn 3y ago
Yes, because it's the escape character.
It's the reason they didn't chose "${" like many other languages. Because that's a valid sequence in a string literal.
- masklinn 3y agoWhich is a nonsensical reasoning they're also requiring a template processor, so string templates were previously impossible in two different ways. `\{` as an interpolation leader would make sense if untagged string literals became implicit STR templates, but that's not the case.
- scotty79 3y agoI guess they want to force you to choose interpolator. So that you won't implicitly use STR when you should have explicitly use SQL.
- masklinn 3y ago> I guess they want to force you to choose interpolator. In which case using `\{}` as the interpolation signal is completely unnecessary, because the new syntax already solves the backward compatibility concerns. Using just `{x}` like C# and Python, or `$x`/`${x}` like Kotlin, would have sufficed and made the syntax a lot more palatable. So would using postfix format specifiers, because that printf-style prefix garbage is just gnarly.
- scotty79 3y ago\{ protects you from forgetting to use interpolator at all. No other syntax that uses same delimiters as string literal would.
- deleted 3y ago[deleted]