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 subscript inside WhateverCode inside block doesn't properly close over lexical #6098
Comments
From @smlsA WhateverCode containing an array subscript that is itself a A WhateverCode closing over a lexical variable usually works fine, But when *both* of those features are combined, *and* the variable sub f { my The same, using `map`: say (1..3).map: { (*.[* - $_])(<a b c>) }; # (c c c) The expected output would be `(c b a)`. For some reason, it seems to Demonstration that the particular circumstances described above have 1) If the WhateverCode subscript is replaced with a static expression, say (1..3).map: { (*.[3 - $_])(<a b c>) }; # (c b a) 2) If the outer WhateverCode is removed by "inlining" it, the bug disappears: say (1..3).map: { <a b c>[* - $_] }; # (c b a) 3) If the `map` is unrolled so that there is no outer block that gets my &f = *.[* - $_]; This is Rakudo version 2017.02-95-g0be724727 built on MoarVM version |
From @smlsReplacing the outer WhateverCode with a Block lambda, makes the bug disappear: say (1..3).map: -> $n { {.[* - $n]}(<a b c>) }; # (c b a) Replacing the WhateverCode subscript with a Block lambda subscript, makes the bug disappear: say (1..3).map: -> $n { (*.[{$_ - $n}])(<a b c>) }; # (c b a) |
From @smlscommittable reveals that the bug has existed since before 2014.01: https://gist.github.com/Whateverable/3ccc9613317d5d5241021431e8e525bb |
From @zoffixznetOn Sat, 25 Feb 2017 06:55:02 -0800, smls75@gmail.com wrote:
Thank you for the report. This is now fixed. Fix: rakudo/rakudo@e8c6c259ce72fb5 |
The RT System itself - Status changed from 'new' to 'open' |
@zoffixznet - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#130859 (status was 'resolved')
Searchable as RT130859$
The text was updated successfully, but these errors were encountered: