I think the whole idea of overloading the '&&' and '||' operators is too
farfetched. It's and incredibly dangerous can of worms, precedence rules
changing, shortcircits not working, etc.

Actually, we don't need it. All we need, is lazy evaluation.

The idea comes from Lisp, where you have a possibility to create
ordinary looking functions (in Lisp, there's no difference between a
function and an operator; the less polite name is "prefix notation");
but the calculation of the values of the parameters can be postponed
until the time when the sub is already running. In fact, it won't be
calculated, unless you invoke it yourself. (How? "eval"?)

Then, we could simply write our own versions of shortcutting AND and OR.
The difference would be that it would look like a function, not like an
operator. Compare:

        expr1 && expr2
vs.
        AND(expr1, expr2)

but at least, there would be no confusion WRT precedence rules.

-- 
        Bart.

Reply via email to