On Friday, 26 April 2019 at 16:59:15 UTC, H. S. Teoh wrote:
On Fri, Apr 26, 2019 at 02:33:16PM +0000, Taylor Hillegeist via
Digitalmars-d-learn wrote:
On Friday, 26 April 2019 at 10:22:49 UTC, Bastiaan Veelo wrote:
[...]
> Proofing the concept:
> ---
> mixin(snoop(q{
> int fun(int a, int b)
> {
> int c = 3;
> foreach (i; 1 .. 5)
> {
> a += i;
> }
> int d = a + b + c;
> return d;
> }
> }));
> ---
>
> Output:
> 2019-Apr-26 10:33:46.0935135 executed line 7: int c
> = 3;
> 2019-Apr-26 10:33:46.0936716 executed line 10: a
> += i;
> 2019-Apr-26 10:33:46.0937348 executed line 10: a
> += i;
> 2019-Apr-26 10:33:46.0937963 executed line 10: a
> += i;
> 2019-Apr-26 10:33:46.0938583 executed line 10: a
> += i;
> 2019-Apr-26 10:33:46.0939622 executed line 12: int d
> = a + b +
> c;
Now *this* is some seriously cool stuff.
Thanks!
A limitation is that snoop() needs to be pure. At one time I had
a byLine in there, but for some reason byLine is not pure so that
didn't work. I was almost about to see if I could use libdparse
in it (run.dlang.io supports it) but I should spend my time on
preparing for DConf instead... Feel free to play with it, this
stuff is fun!
Bastiaan.