
On Jan 1, 2009, at 7:22 PM, Andrey Semashev wrote:
Gordon Woodhull wrote:
I believe what Jason is talking about is compile-time filtering where the compiler actually does know the answer and is able to eliminate code. The "trivial 'if'" is gone after optimization. This seems like a very nice feature to me.
I agree that this is a very useful feature. One of my points in the reply to Jason was that there are simpler and more efficient ways to do it than employing metaprogramming and hoping that the optimizer does the rest.
I like the idea of expression templates for logging and find Jason's syntax somewhat compelling, allowing different output to different sinks from the same line. But I recognize that macros are going to be the best solution for many projects, and it seems hard to match the sureness that they'll completely compile away.
Although lazy functions solve the problem, they complicate logging a lot. If you just want to put to log the result of a function call, you have to create a lambda expression or some functional wrapper for that call. I know, this is quite simple with Phoenix or Lambda, but this is still quite an amount of scaffolding for such a trivial task.
Yeah, it might be annoying to have to lazify every item that might cost processor time!