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

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

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



Subject: [BUG] 'undo' won't fire unless the block is a 'try' block in Rakudo
Date: Tue, 20 Mar 2012 10:03:43 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 647b
<moritz> r: ENTER { say 1 } <p6eval> rakudo b2505b: OUTPUT«1␤» <moritz> r: KEEP { say 1 } <p6eval> rakudo b2505b: OUTPUT«1␤» <moritz> r: UNDO { say 1 } <p6eval> rakudo b2505b: ( no output ) So far, so good. But: <moritz> r: UNDO { say 'undone' }; die 'foo' <p6eval> rakudo b2505b: ( no output ) <moritz> that doesn't look right :/ * masak submits rakudobug <masak> expected output: 'undone␤foo at blablabla' <moritz> r: do { UNDO say "undone"; die "foo" } <p6eval> rakudo b2505b: OUTPUT«foo␤ in block <anon> at /tmp/zh8VsY8sVT:1␤␤» <masak> r: try { UNDO say "undone"; die "foo" } <p6eval> rakudo b2505b: OUTPUT«undone␤»
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 972b
On Tue Mar 20 02:03:58 2012, masak wrote: Show quoted text
> <moritz> r: ENTER { say 1 } > <p6eval> rakudo b2505b: OUTPUT«1␤» > <moritz> r: KEEP { say 1 } > <p6eval> rakudo b2505b: OUTPUT«1␤» > <moritz> r: UNDO { say 1 } > <p6eval> rakudo b2505b: ( no output ) > > So far, so good. But: > > <moritz> r: UNDO { say 'undone' }; die 'foo' > <p6eval> rakudo b2505b: ( no output ) > <moritz> that doesn't look right :/ > * masak submits rakudobug > <masak> expected output: 'undone␤foo at blablabla' > <moritz> r: do { UNDO say "undone"; die "foo" } > <p6eval> rakudo b2505b: OUTPUT«foo␤ in block <anon> at
/tmp/zh8VsY8sVT:1␤␤» Show quoted text
> <masak> r: try { UNDO say "undone"; die "foo" } > <p6eval> rakudo b2505b: OUTPUT«undone␤»
Also: <moritz> n: do { UNDO say "undone"; die "foo" } <p6eval> niecza v15-4-g1f35f89: OUTPUT«undone␤Unhandled exception: foo [...] <masak> r: sub foo { UNDO say "undone"; fail }; foo; say "alive" <p6eval> rakudo b2505b: OUTPUT«alive␤»
Download (untitled) / with headers
text/plain 1.2k
On Tue Mar 20 02:59:11 2012, masak wrote: Show quoted text
> On Tue Mar 20 02:03:58 2012, masak wrote:
> > <moritz> r: ENTER { say 1 } > > <p6eval> rakudo b2505b: OUTPUT«1␤» > > <moritz> r: KEEP { say 1 } > > <p6eval> rakudo b2505b: OUTPUT«1␤» > > <moritz> r: UNDO { say 1 } > > <p6eval> rakudo b2505b: ( no output ) > > > > So far, so good. But: > > > > <moritz> r: UNDO { say 'undone' }; die 'foo' > > <p6eval> rakudo b2505b: ( no output ) > > <moritz> that doesn't look right :/ > > * masak submits rakudobug > > <masak> expected output: 'undone␤foo at blablabla' > > <moritz> r: do { UNDO say "undone"; die "foo" } > > <p6eval> rakudo b2505b: OUTPUT«foo␤ in block <anon> at
> /tmp/zh8VsY8sVT:1␤␤»
> > <masak> r: try { UNDO say "undone"; die "foo" } > > <p6eval> rakudo b2505b: OUTPUT«undone␤»
> > Also: > > <moritz> n: do { UNDO say "undone"; die "foo" } > <p6eval> niecza v15-4-g1f35f89: OUTPUT«undone␤Unhandled exception:
foo Show quoted text
> [...] > <masak> r: sub foo { UNDO say "undone"; fail }; foo; say "alive" > <p6eval> rakudo b2505b: OUTPUT«alive␤» >
the first complaint now works, but the rest still don't. 19:22 <diakopter> r: UNDO { say 'undone' }; die 'foo' 19:22 <p6eval> rakudo 024843: OUTPUT«undone␤»
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.2k
Currently things are as follows: Moar get's all of this right: $ perl6-m -e 'UNDO { say "undone" }; die "foo"' undone foo in block <unit> at -e:1 $ perl6-m -e 'do { UNDO say "undone"; die "foo" }' undone foo in block <unit> at -e:1 $ perl6-m -e 'try { UNDO say "undone"; die "foo" }' undone $ perl6-m -e 'sub foo { UNDO say "undone"; fail }; foo; say "alive"' undone alive Parrot has trouble with the first two commands (without block and "do" block), the other two run fine ("try" block and sub): $ perl6-p -e 'UNDO { say "undone" }; die "foo"' undone $ perl6-p -e 'do { UNDO say "undone"; die "foo" }' foo in block <unit> at -e:1 $ perl6-p -e 'try { UNDO say "undone"; die "foo" }' undone $ perl6-p -e 'sub foo { UNDO say "undone"; fail }; foo; say "alive"' undone alive JVM has trouble with the second and third command ("do" block and "try" block), the other two run fine (without block and sub): $ perl6-j -e 'UNDO { say "undone" }; die "foo"' undone foo in block <unit> at -e:1 $ perl6-j -e 'do { UNDO say "undone"; die "foo" }' foo in block <unit> at -e:1 $ perl6-j -e 'try { UNDO say "undone"; die "foo" }' $ perl6-j -e 'sub foo { UNDO say "undone"; fail }; foo; say "alive"' undone alive I'll add tests later (after this month's Rakudo release).
Tests added to S04-phasers/keep-undo.t with commit https://github.com/perl6/roast/commit/933059b19f


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