yet another string interp dip, simple edition

cc cc at nevernet.com
Thu Jan 18 20:30:43 UTC 2024


On Monday, 15 January 2024 at 00:11:13 UTC, Alexandru Ermicioi 
wrote:
> On Sunday, 14 January 2024 at 23:20:36 UTC, monkyyy wrote:
>> `i"$foo $bar"` makes a string literal at the call site, no one 
>> gets to format anything, make templates, or anything else; no 
>> change to templates syntax for to match some strange usecase 
>> that no one remembers anymore.
>>
>> `i"$$"=='$'` double $ is the excape, so theres only one 
>> control char that changes
>>
>> `float f=1.337; assert(i"$f"=="1.34");` floats are round two 
>> digits, always
>>
>> `Vector2 v; assert(i"$v"==v.toString);` structs reuse the 
>> toString norms
>>
>> `int array=[1,2,3]; assert(mixin(i"$array")==array);` base 
>> types and combinations of base types, create sane mixins
>
> what about security issues such as sql injection?

If your programmer is using string interpolation for sensitive 
sql queries, you fire the programmer.


More information about the Digitalmars-d mailing list