Larry Wall wrote: > Jon Lang wrote: > : 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? > > As a metaoperator it automatically extends to user-defined comparison > operators, but I admit that's not a strong argument. Mostly I want > to encourage the meme that you can use - to reverse a comparison > operator, even in spots where the operator is named by strings, such > as (potentially) in an OrderingPair, which currently can be written > > &extract_key => &infix:<-leg> > > but that might be abbreviate-able to > > :extract_key<-leg> > > or some such. That's not a terribly strong argument either, but > perhaps they're additive, if not addictive. :)
So "$a -<=> $b" is equivalent to "$b <=> $a", not "-($a <=> $b)". OK. I'd suggest choosing a better character for the meta-operator (one that conveys the meaning of reversal of order rather than opposite value); but I don't think that there is one. > : 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? > > It would be a tie, since both operators are the same length. I guess I don't understand the longest-token rules, then. I'd expect the parser to be deciding between operator "-=" (a single two-character token) vs. meta-operator "-" (a one-character token) followed by operator "=" (a separate one-character token). Since meta-op "-" is shorter than op "-=", I'd expect op "-=" to win out. -- Jonathan "Dataweaver" Lang