Interpolated strings and SQL

Paolo Invernizzi paolo.invernizzi at gmail.com
Tue Jan 9 23:49:04 UTC 2024


On Tuesday, 9 January 2024 at 23:21:34 UTC, Walter Bright wrote:

>> Constructing it at compile time is essential so that we can 
>> validate the generated SQL and abort compilation, as Paolo 
>> [demonstrated](https://forum.dlang.org/post/qbtbyxcglwijjbeygtvi@forum.dlang.org).
>
> That only checks one aspect of correctness - nested string 
> interpolations.

<snip>

>> DIP1036 has no such limitation (demonstrated in point 2 
>> [here](https://forum.dlang.org/post/lizjwxdgsnmgykaoczyf@forum.dlang.org)).
>
> DIP1036 cannot detect other problems with the string literals. 
> It seems like a lot of complexity to deal with only one issue 
> with malformed strings at compile time rather than runtime.

You are underestimating what can be gained as value in catching 
SQL problems at compile time instead of runtime. And, believe me, 
it's not a matter of mocking the DB and relying on unittest and 
coverage.

CTFE capability is needed.

/P




More information about the Digitalmars-d mailing list