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

A user-declared infix:<;> clashes with statement stopper ';' in Rakudo #2408

Closed
p6rt opened this issue Apr 16, 2011 · 5 comments
Closed

A user-declared infix:<;> clashes with statement stopper ';' in Rakudo #2408

p6rt opened this issue Apr 16, 2011 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Apr 16, 2011

Migrated from rt.perl.org#88704 (status was 'resolved')

Searchable as RT88704$

@p6rt
Copy link
Author

p6rt commented Apr 16, 2011

From @masak

<masak> awww.
<masak> who would have guessed, declaring a sub infix​:<;> causes problems...
<masak> rakudo​: our sub infix​:<;>($lhs, $rhs) {}; { say "A"; say "B" }
<p6eval> rakudo 5ac05e​: ( no output )
<masak> :(
<masak> rakudo​: our sub infix​:<;>($lhs, $rhs) { say $lhs, $rhs }; 1; 2; 3
<p6eval> rakudo 5ac05e​: OUTPUT«infix​:<;>1␤Bool​::True2␤Bool​::True3␤»
<masak> I believe this is backwards. the stopper ';' should take
precedence over any declared infixes, unless we're inside a
parenthetical thingy.
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Apr 16, 2011

From @masak

On Sat Apr 16 05​:37​:53 2011, masak wrote​:

<masak> awww.
<masak> who would have guessed, declaring a sub infix​:<;> causes
problems...
<masak> rakudo​: our sub infix​:<;>($lhs, $rhs) {}; { say "A"; say "B" }
<p6eval> rakudo 5ac05e​: ( no output )
<masak> :(
<masak> rakudo​: our sub infix​:<;>($lhs, $rhs) { say $lhs, $rhs }; 1;
2; 3
<p6eval> rakudo 5ac05e​: OUTPUT«infix​:<;>1␤Bool​::True2␤Bool​::True3␤»
<masak> I believe this is backwards. the stopper ';' should take
precedence over any declared infixes, unless we're inside a
parenthetical thingy.
* masak submits rakudobug

<jnthn> What does STD think?
<jnthn> std​: sub infix​:<;>($, $) {}; { say "A"; say "B" }
<p6eval> std 4608239​: OUTPUT«ok 00​:01 122m␤»
<jnthn> I'm thinking that example doesn't force it to reveal what it's
parsing that ; as though
<jnthn> And wondering how to construct one that does :)
<colomon> without executing the code, I can't see how to do it.
<jnthn> oh, maybe you can do it with statement modifiers
<jnthn> std​: sub infix​:<;>($, $) {}; { say "A" if 1; say "B" if 1; }
<p6eval> std 4608239​: OUTPUT«ok 00​:01 122m␤»
<jnthn> I expect that'd fail if the ; wasn't being parsed as a statement
sep there.
<masak> jnthn++
* masak submits rakudobug
<jnthn> You already did submit the Rakudo bug! :P
<masak> apparently I'm getting senile.
<masak> ok, I'll just amend that ticket, then.
<colomon> std​: (say "A" if 1) + 10
<p6eval> std 4608239​: OUTPUT«ok 00​:01 121m␤»
<colomon> jnthn​: are you sure?
<masak> colomon​: yes, it's the 'if' twice that makes it work.
<jnthn> std​: say "A" if 1 + say "B" if 1
<p6eval> std 4608239​: OUTPUT«�[31m===�[0mSORRY!�[31m===�[0m␤Confused [...]
FAILED 00​:01 120m␤»

@p6rt
Copy link
Author

p6rt commented Apr 16, 2011

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 11, 2013

From @moritz

Now tested in S06-operator-overloading/semicolon.t

@p6rt
Copy link
Author

p6rt commented Aug 11, 2013

@moritz - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant