[OT] C# can do all the interpolated strings now

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Dec 9 10:46:28 UTC 2021


On Thursday, 9 December 2021 at 07:47:40 UTC, WebFreak001 wrote:
> I wonder why are most languages using $ or {}? What's the 
> advantage over `\(...)`?

```$``` is a historical variable prefix, dates back to BASIC and 
shell scripting languages, so basically back to the 60s and 70s. 
It makes variable-substitution stand out visually.

```{}``` is really the best "mnemonic" as it signifies a chunk of 
executed code, so from a usability perspective that is the best 
option. Then you can use ```{{``` for escape. People who love 
string mixins probably disagree…

I don't like backslashes for common escapes, makes code harder to 
read. Anyone that has spent a significant amount of time 
debugging long regex's can attest to that. The backslash is used 
for so many other escapes in strings and custom string notations 
that it does not stand out as much.



More information about the Digitalmars-d mailing list