Discussion Thread: DIP 1036--String Interpolation Tuple Literals--Community Review Round 2
Imperatorn
johan_forsberg_86 at hotmail.com
Thu Feb 4 17:49:06 UTC 2021
On Thursday, 4 February 2021 at 17:39:50 UTC, Q. Schroll wrote:
> On Thursday, 4 February 2021 at 16:31:17 UTC, Arafel wrote:
>> [...]
>
> When Adam D. Ruppe wrote about SQL injections, I thought about
> that. The signature of `execute` must not take a string as the
> only parameter for sure. This is the basic pattern for
> accepting an interpolated sequence.
>
> auto execute(string str, Args...)(interp!str first, Args
> rest) { }
>
> If you call `execute` with `execute(i"SELECT ${name} FROM
> table"), the compiler tries i"SELECT ${name} FROM
> table".tupleof and finds a PERFECT match to the above template.
> If that `execute` is the only one available, you cannot use it
> with something other than an interpolated string as the first
> parameter; nothing else (like a regular string literal) will
> match `interp!str`.
@everyone:
We discuss more in depth on Discord. If you want to you could
join the server and flesh out your ideas there. Easier to clarify
various concepts imo.
More information about the Digitalmars-d
mailing list