On 2009-05-21 Larry Wall <la...@wall.org> wrote:
> : <dakkar> rakudo: sub infix:<R>($a,$b) { $a ~ '-' ~ $b }; sub
> : infix:<RR>($a,$b) { $a ~ '_' ~ $b }; say 'x' R 'y'; say 'x' RR 'y';
> : <p6eval> rakudo e6b463: OUTPUT«x-y␤x_y␤»
> : <dakkar> now, apart from "don't do that", what should happen?
> : [snip]
> : <dakkar> jnthn: about the meta-operator collision thing, S03 says
> : that you can't modify with '!' forms that start with '!', and you
> : can't modify with '=' forms that end with '='

Ok, let me try to explain what I was aiming at…

If we have a normal operator, whose spelling is the same as a
meta-modified version of another operator, which one should get
called? The normal (like rakudo does today), or the meta-modified? IN
my example, is the output correct, or should it have been «x-y␤y-x␤» ?

> I don't see a bug here.  First, there's no prohibition on multiple
> similar metas anymore.  But with regard to the example above, metas
> are parsed as their own tokens, and the infix:<RR> is longer than
> the meta R, so should take precedence under LTM.

Ok, so this means that rakudo does the right thing, which looks pretty
sensible to me.

So normal operators will always take precedence against meta-modified
operators. Should there be a way to explicitly say "I mean a
meta-operator here"? If I write:

  sub infix:<»ö«>($a,$b) { return "butterfly between $a and $b" }
  sub infix:<ö>($a,$b) { return abs($a-$b) }

how do I make:

  say (1,2,3) »ö« (3,4,5)

print:

  2 2 2

(apart from doing it "the hard way" with map, zip, etc)?

-- 
        Dakkar - <Mobilis in mobile>
        GPG public key fingerprint = A071 E618 DD2C 5901 9574
                                     6FE2 40EA 9883 7519 3F88
                            key id = 0x75193F88

   This one's tricky. You have to use imaginary numbers, like
   eleventeen ... -- Hobbes

Attachment: signature.asc
Description: PGP signature

Reply via email to