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

WhateverCode loses its mind inside //= #4664

Closed
p6rt opened this issue Oct 21, 2015 · 5 comments
Closed

WhateverCode loses its mind inside //= #4664

p6rt opened this issue Oct 21, 2015 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Oct 21, 2015

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

Searchable as RT126415$

@p6rt
Copy link
Author

p6rt commented Oct 21, 2015

From @TimToady

Using a normal closure works​:

lucca​:~/rc 1244> cat foo
my @​isprime = False,False; # 0 and 1 are not prime by definition

say (for 1 .. 10 -> $i {
  $i if @​isprime[$i] //= so $i %% none 2 ...^ { $_ > $i.sqrt.floor };
})
lucca​:~/rc 1245> p foo
(2 3 5 7)

Using a WhateverCode doesn't work​:

lucca​:~/rc 1246> cat bar
my @​isprime = False,False; # 0 and 1 are not prime by definition

say (for 1 .. 10 -> $i {
  $i if @​isprime[$i] //= so $i %% none 2 ...^ * > $i.sqrt.floor;
})
lucca​:~/rc 1247> p bar
(2 3 4 5 6 7 8 9 10)

But it works again if we expand out the //= to its desugar​:

lucca​:~/rc 1250> cat baz
my @​isprime = False,False; # 0 and 1 are not prime by definition

say (for 1 .. 10 -> $i {
  $i if @​isprime[$i] = @​isprime[$i] // so $i %% none 2 ...^ * >
$i.sqrt.floor;
})
lucca​:~/rc 1251> p baz
(2 3 5 7)

@p6rt
Copy link
Author

p6rt commented Oct 7, 2017

From @dogbert17

This seems to have been fixed with commit rakudo/rakudo@d1c2e76. There were tests added at the same time, i.e. Raku/roast@e797f92 but I'm unsure if those tests cover this RT. If they do then this ticket can probably be marked as resolved.

@p6rt
Copy link
Author

p6rt commented Oct 7, 2017

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

@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

From @zoffixznet

Tests​: Raku/roast@2d35dd49497723ba5bdcc8ef

@p6rt p6rt closed this as completed Dec 12, 2017
@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant