[OT] C# can do all the interpolated strings now
WebFreak001
d.forum at webfreak.org
Thu Dec 9 14:25:58 UTC 2021
On Thursday, 9 December 2021 at 13:03:21 UTC, Ola Fosheim Grøstad
wrote:
> On Thursday, 9 December 2021 at 12:43:31 UTC, Adam D Ruppe
> wrote:
>> On Thursday, 9 December 2021 at 10:43:07 UTC, deadalnix wrote:
>>> So I read the proposal for string interpolation in D, which I
>>> understand to be this one:
>>> https://github.com/John-Colvin/YAIDIP
>>>
>>> The immediate thing that stroke me is the shell example. The
>>> proposed exemple is simply terrible code as it allows for
>>> shell injection.
>>
>> You say you read it, then say something that is blatantly
>> false about it.
>>
>> This dip does NOT produce strings. It produces argument lists.
>> The receiving function knows what was part of the string
>> literal and what were arguments and can process them
>> accordingly.
>
> But don't you think it would be better if you could write:
>
> ```
> sql"SELECT x,y,z FROM {something} FROM {condition}"
> ```
>
> [...]
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
More information about the Digitalmars-d
mailing list