Discussion Thread: DIP 1036--Formatted String Tuple Literals--Community Review Round 1
Walter Bright
newshound2 at digitalmars.com
Sat Sep 12 07:46:03 UTC 2020
The DIP mentions a problem with DIP1027:
Window createWindow(string title, int width = 0, int height = 0);
auto window = createWindow(i"Process debugger $pid");
and the pid value inadvertently being matched to `width`. The DIP says:
"Without a way to detect this misuse"
There is a way, as the expansion will be:
createWindow(tuple("Process debugger %s", pid));
and the compiler can warn if a tuple argument precedes a default argument. I do
not necessarily agree, however, that this is a problem that needs solving, just
that there are ways.
More information about the Digitalmars-d
mailing list