Feedback Thread: DIP 1036--String Interpolation Tuple Literals--Community Review Round 2

Steven Schveighoffer schveiguy at gmail.com
Fri Jan 29 13:40:26 UTC 2021


On 1/29/21 6:49 AM, SealabJaster wrote:
> On Wednesday, 27 January 2021 at 10:33:53 UTC, Mike Parker wrote:
>> ...
> 
> Reposting this here at Walter's request:
> 
> Finally, and I'm sorry if I missed this being described in the DIP, but 
> consider
> this case (and similar):
> 
> ```
> void f(T)(T array)
> if(isArray!T)
> {
>      //...
> }
> 
> f(i"...");
> ```
> 
> What would happen here? My best guess is that it won't compile unless 
> written as `f(i"...".idup)` which then introduces an odd discrepancy 
> where there's certain usages that still require explicitly calling 
> .idup, e.g. `i"...".idup.splitter`
> 

Sorry for not responding in the discussion thread.

the above will work fine with the DIP. What will happen is that 
isArray!(interp!"...") will be false, and there will be no match for f. 
Therefore, the compiler will rewrite as f(i"...".idup), which will 
translate correctly to f("...").

If you still have questions, please ask on discussion thread and I can 
answer them.

-Steve


More information about the Digitalmars-d mailing list