
18 Feb
2008
18 Feb
'08
11:02 a.m.
Richard:
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code <011a01c87003$0ff77eb0$6407a80a@pdimov2> thusly:
[...] This thread did spark my interest though and I was able to add && and || to the trunk, complete with the proper short-circuit semantics.
Can you elaborate on the approach you took? I thought it was essentially impossible to replicate the short-circuit semantics with your own user-defined operator|| and operator&&.
It is impossible to overload && in such a way so that in e1 && e2, e2 is not evaluated when e1 is false. But it's possible to overload f && g so that in (f && g)(x) :- f(x) && g(x), g(x) is not evaluated when f(x) is false.