On Tue, Jan 27, 2009 at 9:43 AM,  <pugs-comm...@feather.perl6.nl> wrote:
> +=head2 Reversed comparison operators
> +
> +Any infix comparison operator returning type C<Order> may be transformed 
> into its reversed sense
> +by prefixing with C<->.
> +
> +    -cmp
> +    -leg
> +    -<=>
> +
> +To avoid confusion with the C<-=> operator, you may not modify
> +any operator already beginning with C<=>.
> +
> +The precedence of any reversed operator is the same as the base operator.

If there are only a handful of operators to which the new
meta-operator can be applied, why do it as a meta-operator at all?

This could be generalized to allow any infix operator returning a
signed type (which would include C<Order>) to reverse the sign.  In
effect, "$x -op $y" would be equivalent to "-($x op $y)".  (Which
suggests the possibility of a more generalized rule about creating
"composite operators" by applying prefix or postfix operators to infix
operators in an analogous manner; but that way probably lies madness.)

Also, wouldn't the longest-token rule cause C<-=> to take precedence
over C<=> prefixed with C<->?  Or, in the original definition, the
fact that C<=> isn't a comparison operator?

-- 
Jonathan "Dataweaver" Lang

Reply via email to