String interpolation, after a healthy debate on discord
WebFreak001
d.forum at webfreak.org
Tue Dec 14 11:15:02 UTC 2021
On Tuesday, 14 December 2021 at 11:02:58 UTC, Ogi wrote:
> On Tuesday, 14 December 2021 at 09:35:27 UTC, WebFreak001 wrote:
>> no this proposal does not suggest moving any functionality
>> into the compiler. It suggests to add the istrings (tuples
>> with header) as described in the YAIDIP and have special
>> function calling syntax (`functionName"istring contents"`)
>> that will call any function, that accepts an istring as only
>> argument.
>
> I was referring to YAIDIP. According to it, istring should be
> allowed in `mixin`, `pragma(msg)` and `assert` (missed this
> one). This requires reimplementing `text` in the compiler.
ah right you mean for the built-in istring usage in the compiler
it needs to be implemented.
I don't think it's such a big problem though, as the phobos
implementation would also just be: (a little simplified)
```d
auto text(istring...)(istring s) if (isIString!istring)
{
return text(s[1 .. $]); // removes special __header, just
concatenate rest
}
```
More information about the Digitalmars-d
mailing list