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

Steven Schveighoffer schveiguy at gmail.com
Thu Dec 9 14:57:25 UTC 2021

On 12/9/21 9:25 AM, WebFreak001 wrote:

> Love the idea of having type-safety with this! JS has similar syntax 
> with `` sql`...` `` where it will call the function `sql` with the parts 
> of the interpolated string.
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals 

This is exactly what the proposal is doing. But instead of using `sql` 
as a specialized prefix (you have to be careful with these, as adding 
arbitrary literal prefixes can mess up the grammar) it's just a 
parameter tuple, and you specify the function as normal.

i.e. this is practically identical to:

sql(i"SELECT x,y,z FROM $something WHERE $condition");

Or even:

i"SELECT x,y,z FROM $something WHERE $condition".sql;


More information about the Digitalmars-d mailing list