# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #75600]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=75600 >


<masak> what's the semantics of $2 in a regex with fewer than three parentheses?
<masak> rakudo: say "foo" ~~ /f(.)$2 o/
<p6eval> rakudo b258f5: OUTPUT«foo␤»
<masak> alpha: say "foo" ~~ /f(.)$2 o/
<p6eval> alpha 30e0ed: OUTPUT«Null PMC access in get_string() [...]
<masak> I have to confess I like alpha's reaction better in this case.
* masak submits rakudobug
<jnthn> Great, we spend all our time removing null PMC accesses...
<jnthn> :P
<masak> :)
<jnthn> masak: I guess what you're saying is you want an error?
<masak> aye.
<jnthn> Or at least a warning.
<jnthn> It's one of those things we should be able to spot and barf
over at compile time though, I guess.
<masak> since this is something that we can statically check for...
<masak> right.
<masak> rakudo: say "foo" ~~ / f $0 (.) /
<p6eval> rakudo b258f5: OUTPUT«fo␤»
<jnthn> masak: heh
<masak> jnthn: that's why it must be wrong.

Note that alpha's error is actually a runtime error. Still, it
fortuitously prevents the outright erroneous match shown in the last
evaluation.

Reply via email to