Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Writing an infix operator '>'. #6389

Open
p6rt opened this issue Jul 11, 2017 · 1 comment
Open

- Writing an infix operator '>'. #6389

p6rt opened this issue Jul 11, 2017 · 1 comment
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 11, 2017

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

Searchable as RT131739$

@p6rt
Copy link
Author

p6rt commented Jul 11, 2017

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​:<is>(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​:<is>($r, equiv => :​:(nm));
        return;
    }
    die "Routine given to equiv does not appear to be an operator";;
}

multi sub trait_mod​:<is>(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​:<is>($r, tighter => :​:(nm));
        return;
    }
    die "Routine given to tighter does not appear to be an operator";;
}

multi sub trait_mod​:<is>(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​:<is>($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

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant