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

Steven Schveighoffer schveiguy at gmail.com
Thu Dec 9 14:15:09 UTC 2021


On 12/9/21 2:47 AM, WebFreak001 wrote:
> I wonder why are most languages using $ or {}? What's the advantage over 
> `\(...)`?

I've used the swift syntax, and I don't like it as much. It looks 
somewhat clunky.

Though, really, this is just asthetics.

> 
> With `\` we have the advantage of not reserving another special 
> character in strings - we already use `\`! It'd be fully backwards 
> compatible even without the i prefix.

There are significant problems there though. The intention of the string 
interpolation DIPs so far is not necessarily to generate strings but to 
give a mechanism to overload for string interpolations. So the `i""` 
type is different than `""` on purpose.

Also, other string types do not have escape sequences.

-Steve


More information about the Digitalmars-d mailing list