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

Overflow of writing to aliases of numbered captures #6537

Open
p6rt opened this issue Sep 18, 2017 · 4 comments
Open

Overflow of writing to aliases of numbered captures #6537

p6rt opened this issue Sep 18, 2017 · 4 comments
Labels
9999 regex Regular expressions, pattern matching, user-defined grammars, tokens and rules

Comments

@p6rt
Copy link

p6rt commented Sep 18, 2017

Migrated from rt.perl.org#132121 (status was 'open')

Searchable as RT132121$

@p6rt
Copy link
Author

p6rt commented Sep 18, 2017

From @zoffixznet

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」␤»

@p6rt
Copy link
Author

p6rt commented Sep 18, 2017

From @smls

On Mon, 18 Sep 2017 10​:45​:21 -0700, cpan@​zoffix.com wrote​:

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.)

@p6rt
Copy link
Author

p6rt commented Sep 18, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 18, 2017

From @lizmat

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-archive.perl.org/perl6/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.

@p6rt p6rt added 9999 regex Regular expressions, pattern matching, user-defined grammars, tokens and rules labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
9999 regex Regular expressions, pattern matching, user-defined grammars, tokens and rules
Projects
None yet
Development

No branches or pull requests

1 participant