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

Owner: Nobody
Requestors: beasley [at] web.de
Cc:
AdminCc:

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



Date: Wed, 25 Feb 2015 23:44:16 +0100
Subject: () vs [] influences matching behavior
From: <beasley [...] web.de>
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 181b
say "asdfEnd" ~~ /:ratchet ( xyz || .+! ) End / Results in: Nil say "asdfEnd" ~~ /:ratchet [ xyz || .+! ] End / Results in: 「asdfEnd」 I'd expect them to give the same result.
RT-Send-CC: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 806b
Simpler test-case: say "abcd" ~~ /:ratchet .+! "d" /; # 「abcd」 say "abcd" ~~ /:ratchet [.+!] "d" /; # 「abcd」 say "abcd" ~~ /:ratchet (.+!) "d" /; # Nil I think this may actually not be a bug. The () creates a proper subpattern, and the :ratchet modifier prevent backtracking back into that subpattern. The [], on the other hand, is simply for grouping. One thing that is slightly surprising, though, is that the following still matches: say "abcd" ~~ /:ratchet ["foo" || .+!] "d" /; # 「abcd」 S05 suggests that :ratchet should prevent backtracking into an alternation: The new :r or :ratchet modifier [...] imply a : after every atom, including [...] alternations. Does that only refer to declarative alternations with `|`, and not to sequential ones with `||` ?
Download (untitled) / with headers
text/plain 441b
Turns out there is already ticket #123934 for the question of whether both `|` and `||` style alternations should be affected by the :ratchet modifier. So *this* ticket can be reduced to the question of whether the following two should behave the same as far as matching is concerned: Show quoted text
> say "abcd" ~~ /:r [.+!] "d" /; # 「abcd」 > say "abcd" ~~ /:r (.+!) "d" /; # Nil
As I stated in my previous comment, I'm not convinced they should.


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