DIP 1027---String Interpolation---Format Assessment

nullptr null at p.tr
Tue Feb 25 14:56:16 UTC 2020


On Tuesday, 25 February 2020 at 13:39:40 UTC, Aliak wrote:
> On Tuesday, 25 February 2020 at 13:04:41 UTC, Adam D. Ruppe 
> wrote:
>> On Tuesday, 25 February 2020 at 09:36:25 UTC, aliak wrote:
>>> [...]
>>
>> Yes, that is the key impetus of our amendment, which I also 
>> wrote up on a gist weeks ago.... and it is now on github too! 
>> https://github.com/dlang/DIPs/pull/186
>>
>> [...]
>
> I should’ve been more specific 😬 I was wondering if the same 
> could be achieved without a introducing a new aggregate type!

In my opinion the only really viable solutions are either to 
lower to a function call to format (or similar) such that 
typeof(i"") == string or a new type such as Adam describes so 
that functions can add overloads for it (and specialized compiler 
errors for common misuse cases).

Anything else and you risk users running into inexplicable errors 
because their string isn't a string.


More information about the Digitalmars-d-announce mailing list