Some random things that the author seem to have missed: > but TypeScript, Swift, Kotlin, and Scala take string interpolation to the furthest extreme of encouraging actual code being embedded inside strings Many more languages support that: C# $"{x} plus {y} equals {x + y}" Python f"{x} plus {y} equals {x + y}" JavaScript `${x} plus ${y} equals ${x + y}` Ruby "#{x} plus #{y} equals #{x + y}" Shell "$x plus $y equals $…
My view on this is that it shouldn’t be interpreted as code being embedded inside strings, but as a special form of string concatenation syntax. In turn, this would mean that you can nest the syntax, for example:
"foo { toUpper("bar { x + y } bar") } foo"
The individual tokens being (one per line): "foo {
toUpper
(
"bar {
x
+
y
} bar"
)
} foo"
If `+` does string concatenation, the above would effectively be equivalent to: "foo " + toUpper("bar " + (x + y) + " bar") + " foo"
I don’t know if there is a language that actually works that way.