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

WebFreak001 d.forum at webfreak.org
Thu Dec 9 15:20:42 UTC 2021


On Thursday, 9 December 2021 at 15:16:40 UTC, WebFreak001 wrote:
> On Thursday, 9 December 2021 at 14:57:25 UTC, Steven 
> Schveighoffer wrote:
>> [...]
>>
>> i.e. this is practically identical to:
>>
>> ```d
>> sql(i"SELECT x,y,z FROM $something WHERE $condition");
>> ```
>>
>> Or even:
>>
>> ```d
>> i"SELECT x,y,z FROM $something WHERE $condition".sql;
>> ```
>>
>> -Steve
>
> [...]

and I want to add, this is the super rare case:

```d
foo(i"hello $name")
```

this is the much more common case:

```d
foo(i"hello $name".text)
// or
foo(text(i"hello $name"))
```

I don't think the common case should always have this extra `i` 
prefix + needed function calling parentheses or ufcs dot. Just 
only writing `text"hello $name"` is shorter, easier to type, 
better to read.


More information about the Digitalmars-d mailing list