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

Conspicuous lack of warning when uselessly providing a precedence on a multi operator in Rakudo #3158

Open
p6rt opened this issue Jun 5, 2013 · 1 comment
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 5, 2013

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

Searchable as RT118339$

@p6rt
Copy link
Author

p6rt commented Jun 5, 2013

From @masak

<flussence> rn​: multi infix​:<%>($lhs, Str $rhs) is looser(&infix​:<xx>)
{ $lhs.join​: $rhs }; say '........' xx 8 % "\n"
<camelia> rakudo b2072f, niecza v24-66-gaee6525​: OUTPUT«........
........ ........ ........ ........ ........ ........ ........␤»
<flussence> those \s'es should be \n's...
<colomon> that doesn't seem to have worked?
<flussence> rn​: multi infix​:<%>($lhs, Str $rhs) is looser(&infix​:<xx>)
{ $lhs.join​: $rhs }; say ('........' xx 8) % "\n"
<camelia> rakudo b2072f, niecza v24-66-gaee6525​:
OUTPUT«........␤........␤........␤........␤........␤........␤........␤........␤»
<timotimo> yeah, because of $ instead of @​
<colomon> oh, nevermind
<timotimo> for the $lhs ;)
<masak> timotimo​: should still work, no?
<masak> so, why doesn't it work for @​lhs ?
<moritz> ah, I know what's going on
<quietfanatic> r​: multi infix​:<%>(\lhs, Str $rhs) { say "custom op";
lhs.join​: $rhs }; say ( infix​:<%>('........' xx 8, "\n") ).perl
<camelia> rakudo b2072f​: OUTPUT«custom
op␤"........\n........\n........\n........\n........\n........\n........\n........"␤»
<timotimo> oh, facepalm.
<moritz> since there's already an infix %, you can't define a new one
with a different precedence
<flussence> oh!
<moritz> so the precedence spec is simply ignored
<quietfanatic> oh, I think it'd be nice if you could do that
<timotimo> traits can be applied to the proto only?
<quietfanatic> or wait, is it because it's installing it as a multi?
<timotimo> can only be applied to the proto*
<quietfanatic> I see
<benabik> Multis with different precedence is probably a bad idea.
<quietfanatic> r​: sub infix​:<%%%>(\lhs, Str $rhs) is
looser(&infix​:<xx>) { say lhs.perl; lhs.join​: $rhs }; say ('........'
xx 8 %%% "\n" )
<camelia> rakudo b2072f​: OUTPUT«("........", "........", "........",
"........", "........", "........", "........",
"........").list␤........␤........␤........␤........␤........␤........␤........␤........␤»
<quietfanatic> you're right
<masak> could there maybe be a warning if you try to override the precedence?
<masak> it feels wrongish that it just throws it away.
<colomon> masak​: I think an error, even
* masak submits rakudobug
<masak> colomon​: better? :)
<colomon> masak++

@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