Voting: std.logger

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 10 09:54:12 PDT 2014


On Wednesday, 10 September 2014 at 16:34:06 UTC, Andrei 
Alexandrescu wrote:
> One possibility is to have the first function be a one-liner 
> that forwards to another. That way there will be less code 
> bloating.
>
> void fun(uint l = __LINE__, A...)(A... as) {
>   funImpl(l, as);
> }
>
> private void funImpl(A...)(uint line, A...) {
>   ... bulk of the code goes here ...
> }

Those are already small functions AFAIK (I was speaking about 
symbol bloat, not code bloat). It does not help with compilation 
issue though - each logging call creates a totally new template 
instance which means allocating new object for DMD internal 
representation and running semantic phase for it. And mature 
applications can have thousands of logging calls. I have yet to 
run tests to see actual impact but it concerns me from the pure 
DMD internals point of view.


More information about the Digitalmars-d mailing list