Is there a way to do the same thing in entry and return of a bunch of functions?

Stefanos Baziotis sdi1600105 at di.uoa.gr
Wed Sep 18 21:22:01 UTC 2019


On Wednesday, 18 September 2019 at 01:03:27 UTC, Nicholas Wilson 
wrote:
>
> I think a mixin that does
>
> string LOG_SCOPE = q{
> callDepth++;
> scope(exit) callDepth--;
> }
>
> is probably the easiest. for bonus points
>
> string LOG_SCOPE = q{
> callDepth++;
> debug_log(__FUNCTION__);// or __PRETTY_FUNTION__
> scope(exit) callDepth--;
> }
>
> and the mixin(LOG_SCOPE);

Yes that's what I meant sort of the mixin (where we can also put 
local scope inside etc.).

> I mean you _could_ do some UDA reflection to generate wrapping 
> function that do the indentation, bit that is overkill.

Interesting, I didn't know about that. I didn't completely get it 
but I get
that it seems the easier way to do it is the mixin.

Thanks,
Stefanos


More information about the Digitalmars-d-learn mailing list