Proposal?

Steven Schveighoffer schveiguy at yahoo.com
Wed May 30 19:34:55 UTC 2018


On 5/30/18 3:05 PM, Daniel N wrote:

> void func(NONE...)(string s, NONE, string file = __FILE__, size_t line = 
> __LINE__) if(!NONE.length)
> {
>      import std.stdio;
>      writefln("%s:%d: msg=%s", file, line, s);
> }
> 
> void main() {func("hello"); func("there");
> }

Very cool and interesting pattern. If you now wanted to wrap the 
function (let's say the caller of this wants to forward it's own called 
file/line to it), you could do this as well:

func!()("boo", file, line);

I still think we should be able to wrap __FILE__ and __LINE__ into 
another call without having the wrapping take over the file/line combo.

-Steve


More information about the Digitalmars-d mailing list