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

Adam D. Ruppe destructionator at gmail.com
Mon Feb 1 16:40:54 UTC 2021


On Monday, 1 February 2021 at 16:22:02 UTC, Dukc wrote:
> One problem: `.stringof` is supposed to be a source 
> representation. "foo" in source represents a string, not part 
> of an interpolated string.

Oh I just thought about it some more and interp isn't the problem.

Automatic stringof is madness to begin with since this problem 
isn't unique to this feature. mixin(genric_type.stringof) is 
*always* wrong due to the mismatched scope so there's no good 
reason to have such a broken feature built into the language.

Consider this too: mixin(i"hi ${a+b}") - without the special rule 
- would expand to mixin("hi ", "a+b") so even that a+b is 
interpreted in a different scope.

So we *have* to special case this somehow to work around this 
broken mixin string "feature". Ugh.


More information about the Digitalmars-d mailing list