String Interpolation

Arafel er.krali at gmail.com
Thu Oct 26 13:46:59 UTC 2023


On 26/10/23 13:41, kdevel wrote:
> On Thursday, 26 October 2023 at 09:42:27 UTC, Arafel wrote:
>> [...]
>> I would find it perfect if there were an option to define arbitrary 
>> prefixes to strings [...] like [...] `sql"SELECT * FROM ${table};"`.
> 
> What should the type and the value of that expression be?

If this is to be a flexible solution to build libraries upon, I would 
say that whatever the writer of the interpolation "function" decides.

Now, a bit like Java, the **standard library** (not the language, or 
even druntime) should offer a "basic" intrerpolation function (or 
template, or mixin, or whatever is the underlying mechanism) where you 
get a string with some sane default formatting, something that people 
can use where a string would otherwise be expected.

Corner cases (like taking references, although the ref rvalue DIP might 
be useful here) might be acceptable, but it should Just Work™ in most 
normal situations.


More information about the Digitalmars-d mailing list