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).

Reply via email to