On 04-04-2012 11:43, Zlatin Balevsky wrote:
The problem of abusing the predicate by performing anything other than
logging inside it.
I guess that that does improve readability a bit. However, less than 5%
of the ifs guards anything but Log.*() calls.
You cannot get rid of the predicate without introducing side effects
as I've demonstrated throughout this thread.
By removing the predicate and delegating checks to the logging function,
a _lot_ of boilerplate code is removed. Ideally, as toad said, Java
would have some kind macro system enabling the best of both worlds.
Lacking that, the question becomes: 'is the overhead acceptable?'.
There have been quite a lot of arguments thrown here. In the end,
though, as fred is big and complex, the only answer is to write some
code and actually run the thing. Are varargs bad? Sure. Is the slowdown
unacceptable? No idea. Just bear with my slowness (or do help), and
you'll at least have a convincing argument for the next fool in the line.
On Apr 4, 2012 6:01 AM, "Marco Schulze" <marco.c.schu...@gmail.com
<mailto:marco.c.schu...@gmail.com>> wrote:
Which problem is solved? There's still a predicate there.
On 03-04-2012 20:49, Zlatin Balevsky wrote:
May I suggest a nice little script someone ( novice? ) could
write,
solve the logging problem and learning a thing or two about
language
theory in the process :
Transform:
====
if (LOG.isLoggable(Level.DEBUG)) {
<some complex computation that wouldn't happen otherwise>
<log results of complex computation, maybe other stuff too>
}
====
Into
====
private static void logComplexComputation( .. arguments! .. ) {
< do the stuff above>
}
if (LOG.isLoggable(Level.DEBUG)) {
logComplexComputation( .. arguments ..);
}
====
This gets run as pre-commit hook and the problem is solved with
positive run-time side effects.
On Sun, Mar 25, 2012 at 6:22 PM, Marco Schulze
<marco.c.schu...@gmail.com <mailto:marco.c.schu...@gmail.com>>
wrote:
Working (but incomplete) code is available @
https://github.com/Heiral/fred-staging/tree/logger++
_______________________________________________
Devl mailing list
Devl@freenetproject.org <mailto:Devl@freenetproject.org>
https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
_______________________________________________
Devl mailing list
Devl@freenetproject.org <mailto:Devl@freenetproject.org>
https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
_______________________________________________
Devl mailing list
Devl@freenetproject.org <mailto:Devl@freenetproject.org>
https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
_______________________________________________
Devl mailing list
Devl@freenetproject.org
https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
_______________________________________________
Devl mailing list
Devl@freenetproject.org
https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl