On Wednesday, 30 May 2018 at 10:05:42 UTC, H. S. Teoh wrote:
What about this?

------
struct EndOfArgs { }
EndOfArgs eoa;

void func(string s, EndOfArgs _ = eoa,
        string file = __FILE__, size_t line = __LINE__)
{
        import std.stdio;
        writefln("%s:%d: msg=%s", file, line, s);
}

void main() {
        func("hello");
        func("there");
}
------


Basically, use a dummy empty struct to differentiate between real arguments and context info.


T

Thank you, this seems to work well!

We're using struct Fence { } Fence _ = Fence(), and it doesn't add much overhead.

Barring the proposed compiler change, this seems the cleanest fix.

Reply via email to