Discussion Thread: DIP 1036--Formatted String Tuple Literals--Community Review Round 1

Adam D. Ruppe destructionator at gmail.com
Wed Sep 9 12:17:56 UTC 2020


On Wednesday, 9 September 2020 at 08:12:05 UTC, WebFreak001 wrote:
> I think it's a little bit awkward and risky that things like
>
> foo(Args...)(string a, Args args)
> or I suppose also
> foo(string a, int b)
>
> will get more than one parameter with a call like
>
> foo(i"hello $i");


That would be a type mismatch error since i"..."'s first argument 
is an "interpolated tuple spec", NOT a string. The compiler's 
error message would probably suggest you try ".idup" to convert 
it to a plain string. If you did that, it would just be a single 
argument.

The implicit conversion hasAllSpecs allows *only* happens if 1) 
the user provides a {} component for every interpolated item and 
2) even so, it converts to `immutable(char)*` rather than 
`string`.


More information about the Digitalmars-d mailing list