News for hackers. Stuff that matters.
Re:Why Lisp? by kedean on Thursday May 07, 2015 @09:03PM (#9509449)
For completeness of the argument, this particular problem is solved in the Java world with string formats. With the slf4j interface, that would be:

log.debug("expensive %s %s", debug, message)

The message is not actually formatted into one string unless the DEBUG trace level is enabled. Of course, you are still passing the arguments around, but with object references that's a negligable difference.

I still appreciate the solid example of a problem macros are good at solving, though. Two ways around one problem.

Re:Why Lisp? by nulltype on Thursday May 07, 2015 @09:53PM (#9509591)
What if it's debug() instead of debug? That could be an expensive function that does a bunch of things to produce the debug output.
Re:Why Lisp? by kedean on Thursday May 07, 2015 @10:03PM (#9509631)
Solid point, that would be a downside of the slf4j approach.
Re:Why Lisp? by mateuszf on Friday May 08, 2015 @01:01AM (#9510038)
It's not solved, because method arguments are evaluated eagerly. It means that message argument may not be an expensive expression, because it will be calculated independently whether debug is enabled or not. In case of macros arguments of this method could be evaluated lazily.