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

Owner: Nobody
Requestors: cpan [at] zoffix.com
Cc:
AdminCc:

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



Subject: [REGEX] (RFC?) Overflow of writing to captures
Download (untitled) / with headers
text/plain 729b
Apparently it's possible to assign to capture variables to change what the resultant Match will have. The first question: is this actually something specced and supported? Especially the fact that further captures continue their numbering from the capture we wrote into: m: say "hi hi ho" ~~ /(\w+) \s+ $10=[$0] \s+ (\w+)/ rakudo-moar 476741: OUTPUT: «「hi hi ho」␤ 0 => 「hi」␤ 10 => 「hi」␤ 11 => 「ho」␤» If it's not, it needs to be plugged up. And if it is, then it has this is the bug with overflow: m: say "hi" ~~ / $10000000000000000000000000000000000000000000000000000000000000=(\w) (.)/ rakudo-moar 476741: OUTPUT: «「hi」␤ -6917529027641081856 => 「h」␤ 0 => 「i」␤»
Download (untitled) / with headers
text/plain 502b
On Mon, 18 Sep 2017 10:45:21 -0700, cpan@zoffix.com wrote: Show quoted text
> Apparently it's possible to assign to capture variables to change what > the resultant Match will have. > > The first question: is this actually something specced and supported? > Especially the fact that further captures continue their numbering > from the capture we wrote into
This is documented in the design docs as intentional: http://design.perl6.org/S05.html#Numbered_scalar_aliasing (Except for the overflow bug, of course.)
To: "Zoffix Znet (via RT)" <perl6-bugs-followup [...] perl.org>
Date: Mon, 18 Sep 2017 20:37:45 +0200
Subject: Re: [perl #132121] [REGEX] (RFC?) Overflow of writing to captures
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Download (untitled) / with headers
text/plain 1.2k
Show quoted text
> On 18 Sep 2017, at 19:45, Zoffix Znet (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Zoffix Znet > # Please include the string: [perl #132121] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=132121 > > > > Apparently it's possible to assign to capture variables to change what the resultant Match will have. > > The first question: is this actually something specced and supported? Especially the fact that further captures continue their numbering from the capture we wrote into: > > m: say "hi hi ho" ~~ /(\w+) \s+ $10=[$0] \s+ (\w+)/ > rakudo-moar 476741: OUTPUT: «「hi hi ho」␤ 0 => 「hi」␤ 10 => 「hi」␤ 11 => 「ho」␤» > > > If it's not, it needs to be plugged up. And if it is, then it has this is the bug with overflow: > > m: say "hi" ~~ / $10000000000000000000000000000000000000000000000000000000000000=(\w) (.)/ > rakudo-moar 476741: OUTPUT: «「hi」␤ -6917529027641081856 => 「h」␤ 0 => 「i」␤»
Odd. One would expect something like: $ 6 'use nqp; my $l := nqp::list; nqp::bindpos($l,10000000000000000000000000000000000000000000000000000000000000,42)' Cannot unbox 203 bit wide bigint into native integer for an error.


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