Gleb,

It seems you miss the point here: not only logger should be lazy, but all calls to logger's methods:

logger.debug(formatLongMessage(args)); // formatLongMessage should not
                                       // waste CPU cycles if debug
                                       // logging is off
Hmm, nope. Let me change the debug signature from
debug(message : String) : Unit
to
debug(message : => String) : Unit
or (that is substantially the same)
// annotations and macros will be in Scala very soon :-P
debug(@lazy message : String) : Unit
and all the calls remain the same. So the example shows, that the default lazyness saves me from typing word "lazy" a whole two times! It doesn't look for me as "irrefutable advantage", sorry ;-)

Best regards,
Nick.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to