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

Perl6 REPL forgets the definition of infix sub #6333

Open
p6rt opened this issue Jun 7, 2017 · 4 comments
Open

Perl6 REPL forgets the definition of infix sub #6333

p6rt opened this issue Jun 7, 2017 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 7, 2017

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

Searchable as RT131530$

@p6rt
Copy link
Author

p6rt commented Jun 7, 2017

From amkhlv@gmail.com

This is Rakudo version 2017.04.3-292-ga61746fed built on MoarVM version 2017.04-68-g5f233249
implementing Perl 6.c.

Executing the command "perl6" starts the normal REPL environment.
In the first line I define​:

sub infix​:<w> { $^a + $^b }

and press ENTER. Then, in the next line​:

1 w 2

===SORRY!=== Error while compiling​:
Two terms in a row
------> say 1⏏ w 2

It seems that REPL forgets the definitions of infix subs. This only happens with infix.

@p6rt
Copy link
Author

p6rt commented Nov 3, 2017

From @bduggan

It seems that REPL forgets the definitions of infix subs. This only
happens with infix.

Looks like this happens with at least postfix and postcircumfix, too​:

sub postfix​:<plus>($a) { $a + 99 }; say 3plus;
102
3plus;
===SORRY!=== Error while compiling​:
Confused
------> 3⏏plus;
  expecting any of​:
  whitespace

sub postcircumfix​:<[[ ]]>($a,$b) { $a + $b }; 1[[2]]
3
1[[2]]
Index out of range. Is​: 2, should be in 0..0
  in block <unit> at <unknown file> line 1

@p6rt
Copy link
Author

p6rt commented Jul 9, 2018

From @bduggan

I've written this snippet to help diagnose the issue​:

https://gist.github.com/bduggan/cd2da7ac41da9bdadca4ee80d5e61ce1

(also attached)

This demonstrates the behavior of the internal REPL. I'm not sure
where to go from here. It looks like somehow modifications to the grammar
need to be preserved.

@p6rt
Copy link
Author

p6rt commented Jul 9, 2018

From @bduggan

bug.p6

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