On 09/10/2014 06:54 PM, Dicebot wrote:
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.
Another possibility would be to fix this bug, but the mechanism isn't
particularly elegant nor efficient:
https://issues.dlang.org/show_bug.cgi?id=13455 :o)