Date: Sat, 4 Jul 2026 09:02:15 +0200
On 7/4/26 03:01, Lorand Szollosi via Std-Proposals wrote:
> What lambda stands for is a callable thing
> (function-like or procedure-like); what uneval stands for is something you can
> request to be evaluated.
That's different syntax for the same semantic meaning. Function call
syntax is how C++ expresses the request that something be evaluated.
> // having a type T and bool external_cond()
>
> auto operator||(uneval<T> lhs, uneval<T> rhs)
> {
> // if it were a lambda, both were evaluated by now
> return external_cond()? lhs: rhs;
> }
It's not clear what you mean by that. Is it this?
// called with lambdas as arguments
auto operator||(auto lhs, auto rhs) {
return external_cond() ? lhs() : rhs();
}
Or did you mean to return an unevaluated expression?
// called with lambdas as arguments
auto operator||(auto lhs, auto rhs) {
return external_cond() ? lhs : rhs;
}
Or did you mean external_cond itself to be lazily evaluated?
// called with lambdas as arguments
auto operator||(auto lhs, auto rhs) {
return [lhs, rhs] { return external_cond() ? lhs() : rhs(); };
}
(Of course none of these are legal in C++, nor should they be. I am
merely asking about the semantics, because it's not clear what your
syntax is supposed to mean.)
> What lambda stands for is a callable thing
> (function-like or procedure-like); what uneval stands for is something you can
> request to be evaluated.
That's different syntax for the same semantic meaning. Function call
syntax is how C++ expresses the request that something be evaluated.
> // having a type T and bool external_cond()
>
> auto operator||(uneval<T> lhs, uneval<T> rhs)
> {
> // if it were a lambda, both were evaluated by now
> return external_cond()? lhs: rhs;
> }
It's not clear what you mean by that. Is it this?
// called with lambdas as arguments
auto operator||(auto lhs, auto rhs) {
return external_cond() ? lhs() : rhs();
}
Or did you mean to return an unevaluated expression?
// called with lambdas as arguments
auto operator||(auto lhs, auto rhs) {
return external_cond() ? lhs : rhs;
}
Or did you mean external_cond itself to be lazily evaluated?
// called with lambdas as arguments
auto operator||(auto lhs, auto rhs) {
return [lhs, rhs] { return external_cond() ? lhs() : rhs(); };
}
(Of course none of these are legal in C++, nor should they be. I am
merely asking about the semantics, because it's not clear what your
syntax is supposed to mean.)
-- Rainer Deyke - rainerd_at_[hidden]
Received on 2026-07-04 07:02:25
