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

Owner: Nobody
Requestors: moritz <moritz.lenz+perl [at] gmail.com>
Cc:
AdminCc:

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



Subject: Can't defer to return()
Date: Sat, 25 Dec 2010 12:54:53 +0100
To: rakudobug [...] perl.org
From: Moritz Lenz <moritz [...] faui2k3.org>
Download (untitled) / with headers
text/plain 366b
On Rakudo 2010.12: use v6; sub f($x) { multi return($nv) { nextwith($nv /2); } return $x; } say f 6 I'd expect that to output 3\n, but instead I get Null PMC access in clone() in 'return' at line 1 in 'f' at line 7:test.pl in main program body at line 9:test.pl which is sad, because it prevents me from using a "neat" and evil trick.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 824b
moritz (>): Show quoted text
> On Rakudo 2010.12: > > use v6; > sub f($x) { > multi return($nv) { > nextwith($nv /2); > } > > return $x; > } > say f 6 > > I'd expect that to output 3\n, but instead I get > > Null PMC access in clone() > in 'return' at line 1 > in 'f' at line 7:test.pl > in main program body at line 9:test.pl > > which is sad, because it prevents me from using a "neat" and evil
trick. <masak> rakudo: my &r := &return; sub f { my sub return($v) { say "LOL!"; &r($v + 10) }; return 42 }; say f <p6eval> rakudo 9b8bad: OUTPUT«LOL!␤52␤» <masak> wow! that *works*! <masak> moritz_! :D <masak> moritz_: I have a workaround for one of your RT tickets. * masak adds it to that ticket <moritz_> masak: I have too. I just name the new return differently :-) <masak> now you don't have to :)
Download (untitled) / with headers
text/plain 216b
On 2012.12: <bbkr__> r: sub f($x) { multi return($nv) { nextwith($nv /2); }; return $x; }; say f 6 <p6eval> rakudo 70262f: OUTPUT«===SORRY!===␤Method 'is_dispatcher' not found for invocant of class 'Block'␤»
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 560b
On Fri Jan 04 04:38:30 2013, bbkr wrote: Show quoted text
> On 2012.12: > > <bbkr__> r: sub f($x) { multi return($nv) { nextwith($nv /2); }; > return $x; }; say f 6 > <p6eval> rakudo 70262f: OUTPUT«===SORRY!===␤Method 'is_dispatcher' > not found for > invocant of class 'Block'␤»
Pretty much unchanged: $ perl6 -e 'sub f($x) { multi return($nv) { nextwith($nv /2); }; return $x; }; say f 6' ===SORRY!=== Cannot find method 'is_dispatcher' $ perl6 --version This is perl6 version 2015.06-217-g3776723 built on MoarVM version 2015.06-48-g017d184 -- Will "Coke" Coleda
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 934b
On Wed Jul 08 09:55:39 2015, coke wrote: Show quoted text
> On Fri Jan 04 04:38:30 2013, bbkr wrote:
> > On 2012.12: > > > > <bbkr__> r: sub f($x) { multi return($nv) { nextwith($nv /2); }; > > return $x; }; say f 6 > > <p6eval> rakudo 70262f: OUTPUT«===SORRY!===␤Method 'is_dispatcher' > > not found for > > invocant of class 'Block'␤»
> > Pretty much unchanged: > > $ perl6 -e 'sub f($x) { multi return($nv) { nextwith($nv /2); }; > return $x; }; say f 6' > ===SORRY!=== > Cannot find method 'is_dispatcher' > $ perl6 --version > This is perl6 version 2015.06-217-g3776723 built on MoarVM version > 2015.06-48-g017d184
Updated behavior: $ perl6 -e 'sub f($x) { multi return($nv) { nextwith($nv /2); }; return $x; }; say f 6' Attempt to return outside of any Routine in any call_with_args at gen/moar/m-Metamodel.nqp line 3906 in sub return at -e line 1 in sub f at -e line 1 in block <unit> at -e line 1 -- Will "Coke" Coleda


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