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

xx-repeated expression enclosed in parens can't access the topic $_ of a statement modifier #4731

Closed
p6rt opened this issue Nov 5, 2015 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Nov 5, 2015

Migrated from rt.perl.org#126569 (status was 'resolved')

Searchable as RT126569$

@p6rt
Copy link
Author

p6rt commented Nov 5, 2015

From @smls

This works​:

  ➜ .pick xx 10 given 1..6
  (6 3 1 1 5 1 6 3 4 2)

But putting parens around the xx operation, breaks it​:

  ➜ (.pick xx 10) given 1..6
  ((Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any))

The problem only seem to occur when $_ was set by a statement modifier - not when it was assigned to manually or set by the block form of 'given'.

An example of a useful idiom which relies on putting parens around an xx operation, is
  (EXPRESSION xx *).first(CONSTRAINT)
for "keep retrying EXPRESSION until the result matches CONSTRAINT".

@p6rt
Copy link
Author

p6rt commented May 2, 2016

From @smls

Likely related to RT #​128054.

@p6rt
Copy link
Author

p6rt commented May 28, 2017

From @smls

Still present in

  This is Rakudo version 2017.05-134-g0c5fe56cc built on MoarVM version 2017.05-25-g62bc54e9
  implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented Jan 26, 2018

From @zoffixznet

On Thu, 05 Nov 2015 01​:58​:17 -0800, smls75@​gmail.com wrote​:

This works​:

➜ .pick xx 10 given 1..6
(6 3 1 1 5 1 6 3 4 2)

But putting parens around the xx operation, breaks it​:

➜ (.pick xx 10) given 1..6
((Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any))

The problem only seem to occur when $_ was set by a statement modifier
- not when it was assigned to manually or set by the block form of
'given'.

An example of a useful idiom which relies on putting parens around an
xx operation, is
(EXPRESSION xx *).first(CONSTRAINT)
for "keep retrying EXPRESSION until the result matches CONSTRAINT".

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@1ee89b54074e80c
Test​: Raku/roast@2f2998733a2d8132c

@p6rt
Copy link
Author

p6rt commented Jan 26, 2018

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

@p6rt
Copy link
Author

p6rt commented Jan 26, 2018

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jan 26, 2018
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant