On Thu, Apr 05, 2007 at 11:07:12PM -0700, Jonathan Lang wrote:
: Generalize the negated relational operators to apply to any infix
: operator that returns a boolean.  In terms of the standard operators,
: this will add <&& || ^^ // and or xor err> to the family that is
: implicitly equipped with logical negations.

This will not fly, I'm afraid.  These relationals are not typed to
return Bool, but rather Any.  They work only because all normal values
do the boolean and defined roles, and the operator happens to evaluate
one or more of its Any values for its boolean or defined sense.
But the return value is one or another of the Any values (apart from
the XORs, which do at least return False unless only one of the Anys
is true, in which case you still get an Any).

So basically, either we'd have to pick and choose by precedence level
which infix operators allow meta-!, or open it up to all infix.  That
could get a little strange:

    $a = $b !but $c;

Though one odd operator that might actually be useful is

    $a = $b !% $c;      # short for $a = $b % $c == 0

I doubt that would turn out to be a Best Practice though, and in
general even negated logicals are not going to be terribly useful
in reduce.  So I'm not inclined to change anything currently.


Reply via email to