DIP 1027---String Interpolation---Community Review Round 1

Walter Bright newshound2 at digitalmars.com
Sun Dec 15 01:21:36 UTC 2019


On 12/14/2019 6:47 AM, Steven Schveighoffer wrote:
> What if the strings are all interpolated strings? e.g.:
> 
> database.exec(i"UPDATE %table SET key=$key, value=${f}value "~
>              i"WHERE index < ${d}index AND "~
>              i"timestamp > ${D}lastTime");


Then you'll get a tuple that looks like:

     "UPDATE %s SET key=%s, value=%f ", key, value, "WHERE index < %d AND ", 
index, "timestamp > %D", lastTime

which won't work for printf or writefln.


> I actually think 'i' should be able to go before any string literal.
> e.g.:
> 
> iq{$a + $b}
> i`$a + $b`

Since the other method works, I am striving to keep things as simple as 
possible. There needs to be very good reasons for gratuitous multiple ways of 
doing something, and I don't see one here. Of course, then there's "what about 
qi strings", aaggghhhh.


More information about the Digitalmars-d mailing list