On Wednesday, 15 February 2017 at 22:07:22 UTC, data pulverizer
wrote:
That's great, thanks both of you!
On Wed, Feb 15, 2017 at 10:58:42PM +, ag0aep6g via Digitalmars-d-learn
wrote:
> On Wednesday, 15 February 2017 at 22:34:22 UTC, H. S. Teoh wrote:
> > auto debugPrint(alias fun, A...)(A args) {
> > writefln("%s(%(%s, %))", __traits(identifier, fun), [args]);
> >
On Wednesday, 15 February 2017 at 22:34:22 UTC, H. S. Teoh wrote:
auto debugPrint(alias fun, A...)(A args) {
writefln("%s(%(%s, %))", __traits(identifier, fun), [args]);
return fun(args);
}
string arg = "hello";
string myCall =
On Wed, Feb 15, 2017 at 02:18:48PM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> Try this:
>
> auto debugPrint(string expr)() {
> writeln(expr);
> return mixin(expr);
> }
>
> string myCall = debugPrint!`someFunction(1, "hello")`;
[...]
On Wed, Feb 15, 2017 at 10:07:22PM +, data pulverizer via
Digitalmars-d-learn wrote:
> I'd like to convert a call to a string for debug printing purposes for
> example:
>
>
> ```
> import std.stdio : writeln;
> void someFunction(int x, string y){}
> string myCall = d
I'd like to convert a call to a string for debug printing
purposes for example:
```
import std.stdio : writeln;
void someFunction(int x, string y){}
string myCall = debugPrint(someFunction(1, "hello"));
writeln(myCall);
```
writes:
someFunction(1, "hello")
Does this