Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

- Writing an infix operator '>'. #6389

Open p6rt opened 7 years ago

p6rt commented 7 years ago

Migrated from rt.perl.org#131739 (status was 'new')

Searchable as RT131739$

p6rt commented 7 years ago

From andynparker@googlemail.com

Guys,

Here is a one liner to illustrate a possible bug trying to redefine the operator '>' and I think any other operator with the '\<' or '\<' characters.

 perl6 -e 'multi infix​:«>»( $left, $right --> Bool) is equiv(&infix​:«>») { ... }' ===SORRY!=== Error while compiling -e Routine given to equiv does not appear to be an operator at -e​:1

I think the error lies here in SETTINGS​:

# next three sub would belong to traits.pm if PseudoStash were available # so early in the setting compunit multi sub trait_mod​:\(Routine $r, Str :$equiv!) {     if (my $i = nqp​::index($r.name, '​:')) > 0 {         my \nm ='&' ~ nqp​::substr($r.name, 0, $i+1) ~ '\<' ~ nqp​::escape($equiv) ~ '>';         trait_mod​:\($r, equiv => :​:(nm));         return;     }     die "Routine given to equiv does not appear to be an operator";; }

multi sub trait_mod​:\(Routine $r, Str :$tighter!) {     if (my $i = nqp​::index($r.name, '​:')) > 0 {         my \nm ='&' ~ nqp​::substr($r.name, 0, $i+1) ~ '\<' ~ nqp​::escape($tighter) ~ '>';         trait_mod​:\($r, tighter => :​:(nm));         return;     }     die "Routine given to tighter does not appear to be an operator";; }

multi sub trait_mod​:\(Routine $r, Str :$looser!) {     if (my $i = nqp​::index($r.name, '​:')) > 0 {         my \nm ='&' ~ nqp​::substr($r.name, 0, $i+1) ~ '\<' ~ nqp​::escape($looser) ~ '>';         trait_mod​:\($r, looser => :​:(nm));         return;     }     die "Routine given to looser does not appear to be an operator";;

Using​: perl6 -version This is Rakudo version 2016.11 built on MoarVM version 2016.11 implementing Perl 6.c.

OS is Fedora 24.

Regards,

Andrew N Parker