Proposal?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed May 30 10:05:42 UTC 2018


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

-- 
Don't drink and derive. Alcohol and algebra don't mix.


More information about the Digitalmars-d mailing list