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

Owner: Nobody
Requestors: FROGGS.de <email [at] froggs.de>
Cc:
AdminCc:

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



Date: Fri, 28 Aug 2015 19:05:11 +0200
Subject: [BUG] &?ROUTINE changes to something else in gather in for loop
To: rakudobug [...] perl.org
From: Tobias Leich <email [...] froggs.de>
Download (untitled) / with headers
text/plain 1.1k
m: sub foo { say &?ROUTINE.perl; gather for 1 { say &?ROUTINE.perl; }; gather for 1 { say &?ROUTINE.perl; } }; foo rakudo-moar 5fb81f: OUTPUT«sub foo () { #`(Sub|59748232) ... }␤Code.new␤Code.new␤» rakudo-moar 186223: OUTPUT«sub foo () { #`(Sub|53058688) ... }␤Code.new␤Code.new␤» m: sub foo { say &?ROUTINE.perl; for 1 { say &?ROUTINE.perl; }; gather for 1 { say &?ROUTINE.perl; } }; foo rakudo-moar 5fb81f: OUTPUT«sub foo () { #`(Sub|42434376) ... }␤sub foo () { #`(Sub|42434376) ... }␤Code.new␤» rakudo-moar 186223: OUTPUT«sub foo () { #`(Sub|54308288) ... }␤sub foo () { #`(Sub|54308288) ... }␤Code.new␤» m: sub foo($,$,$) { say &?ROUTINE.arity; for 1 { say &?ROUTINE.arity; }; gather for 1 { say &?ROUTINE.arity; } }; foo 1, 2, 3 rakudo-moar 5fb81f: OUTPUT«3␤3␤0␤» rakudo-moar 186223: OUTPUT«3␤3␤0␤» m: sub foo($,$,$) { say &?ROUTINE.arity; for 1 { say &?ROUTINE.arity; }; gather for 1 { if 1 { say &?ROUTINE.arity } } }; foo 1, 2, 3 rakudo-moar 5fb81f: OUTPUT«3␤3␤3␤» rakudo-moar 186223: OUTPUT«3␤3␤3␤» I expect that the &?ROUTINE in the gather also points to the foo subroutine.
Still reproducible (2017.11,HEAD(e5b660e))

On 2015-08-28 10:05:31, FROGGS.de wrote:
Show quoted text
> m: sub foo { say &?ROUTINE.perl; gather for 1 { say &?ROUTINE.perl; };
> gather for 1 { say &?ROUTINE.perl; } }; foo
> rakudo-moar 5fb81f: OUTPUT«sub foo () { #`(Sub|59748232) ...
> }␤Code.new␤Code.new␤»
> rakudo-moar 186223: OUTPUT«sub foo () { #`(Sub|53058688) ...
> }␤Code.new␤Code.new␤»
>
> m: sub foo { say &?ROUTINE.perl; for 1 { say &?ROUTINE.perl; }; gather
> for 1 { say &?ROUTINE.perl; } }; foo
> rakudo-moar 5fb81f: OUTPUT«sub foo () { #`(Sub|42434376) ... }␤sub foo
> () { #`(Sub|42434376) ... }␤Code.new␤»
> rakudo-moar 186223: OUTPUT«sub foo () { #`(Sub|54308288) ... }␤sub foo
> () { #`(Sub|54308288) ... }␤Code.new␤»
>
> m: sub foo($,$,$) { say &?ROUTINE.arity; for 1 { say &?ROUTINE.arity; };
> gather for 1 { say &?ROUTINE.arity; } }; foo 1, 2, 3
> rakudo-moar 5fb81f: OUTPUT«3␤3␤0␤»
> rakudo-moar 186223: OUTPUT«3␤3␤0␤»
>
> m: sub foo($,$,$) { say &?ROUTINE.arity; for 1 { say &?ROUTINE.arity; };
> gather for 1 { if 1 { say &?ROUTINE.arity } } }; foo 1, 2, 3
> rakudo-moar 5fb81f: OUTPUT«3␤3␤3␤»
> rakudo-moar 186223: OUTPUT«3␤3␤3␤»
>
> I expect that the &?ROUTINE in the gather also points to the foo subroutine.




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