Skip Menu |
Report information
Id: 127906
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: tomentiruran [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Perl6 Regex: Array interpolation depends on order of array elements
To: rakudobug [...] perl.org
From: Andrew Buchanan <tomentiruran [...] gmail.com>
Date: Fri, 15 Apr 2016 19:48:05 +0800
Download (untitled) / with headers
text/plain 133b
The attached file displays the bug, and includes explanation and per6 -V output. Thanks, the language is fun, apart from the bugs!
Download perl6-Array-Order.p6
application/octet-stream 12.5k

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 711b
Still present in 2016.06-154-g55c359e built on MoarVM version 2016.06-9-g8fc21d5 Seems a very specific combination that causes it to fail: zoffix@VirtualBox:~$ perl6 -e 'my @stem = <b bc>; "bc" ~~ / "a" || @stem >> / or say "Failed"' Failed zoffix@VirtualBox:~$ perl6 -e 'my @stem = <b bc>; "b" ~~ / "a" || @stem >> / or say "Failed"' zoffix@VirtualBox:~$ perl6 -e 'my @stem = <bc b>; "b" ~~ / "a" || @stem >> / or say "Failed"' zoffix@VirtualBox:~$ perl6 -e 'my @stem = <bc b>; "bc" ~~ / "a" || @stem >> / or say "Failed"' zoffix@VirtualBox:~$
Download (untitled) / with headers
text/plain 237b
I was able to golf it a bit further (still present in Rakudo 58dc8c). Removing >> or changing first-match || to longest-match | no longer shows the bug: m: "bc" ~~ /||@(<b bc>) >>/ or say "Failed" rakudo-moar 58dc8c: OUTPUT«Failed␤»
Download (untitled) / with headers
text/plain 670b
On Wed, 20 Jul 2016 08:32:12 -0700, cpan@zoffix.com wrote: Show quoted text
> I was able to golf it a bit further (still present in Rakudo 58dc8c). > Removing >> or changing first-match || to longest-match | no longer > shows the bug: > > m: "bc" ~~ /||@(<b bc>) >>/ or say "Failed" > rakudo-moar 58dc8c: OUTPUT«Failed␤»
Still present in: This is Rakudo version 2017.09-227-g8ff76b596 built on MoarVM version 2017.09.1-575-gd4e230a6 implementing Perl 6.c. And it's not specific to `>>`. Even simpler test-case: ➜ say "abc" ~~ /[ a || ab ] c/; # 「abc」 ➜ say "abc" ~~ /||@(<a ab>) c/; # Nil It looks like it simply refuses to backtrack into `||@`.
Download (untitled) / with headers
text/plain 187b
It affects `|` array interpolation as well: ➜ say "ab" ~~ / < ab a > b /; # 「ab」 ➜ say "ab" ~~ / @(<ab a>) b /; # Nil ➜ say "ab" ~~ / |@(<ab a>) b /; # Nil


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org