Date: Mon, 25 May 2026 08:40:02 +0100
On Mon, 25 May 2026 at 08:14, Sebastian Wittmeier via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> The syntax of std::lazy makes it hard to recognize, which parts of the program are lazily evaluated.
>
> Is there a mixture of std::lazy and lambda syntax possible?
The whole point is that it would be as frictionless as possible at the
call site. The exact same issue appears currently with
assert/debug/log macros, where we expect the macro writer to have
sensible semantics about whether/how many times a macro argument is
actually evaluated.
This is currently extremely possible by just wrapping everything in a
lambda, but no one is doing it because it isn't a known/standardized
pattern and it is extremely verbose:
logger.log(log_level::info, [&]{ return std::format("f() called
with argument {}", i); });
// Which leads people to use a macro
LOG_MACRO(logger, log_level::info, "f() called with argument {}", i);
// vs with std::lazy
logger.log(log_level::info, "f() called with argument {}", i);
<std-proposals_at_[hidden]> wrote:
>
> The syntax of std::lazy makes it hard to recognize, which parts of the program are lazily evaluated.
>
> Is there a mixture of std::lazy and lambda syntax possible?
The whole point is that it would be as frictionless as possible at the
call site. The exact same issue appears currently with
assert/debug/log macros, where we expect the macro writer to have
sensible semantics about whether/how many times a macro argument is
actually evaluated.
This is currently extremely possible by just wrapping everything in a
lambda, but no one is doing it because it isn't a known/standardized
pattern and it is extremely verbose:
logger.log(log_level::info, [&]{ return std::format("f() called
with argument {}", i); });
// Which leads people to use a macro
LOG_MACRO(logger, log_level::info, "f() called with argument {}", i);
// vs with std::lazy
logger.log(log_level::info, "f() called with argument {}", i);
Received on 2026-05-25 07:40:42
