Here's a simple test for resumable exceptions that I'm trying
to get to work. I'm probably coding/understanding something wrong,
so any suggestions or pointers would be greatly appreciated.
.sub main :main
push_eh catcher
'foo'()
pop_eh
say 'ok 4'
.return ()
catcher:
.get_results ($P0, $S0)
$P1 = $P0['retcont']
$P1()
.end
.sub 'foo'
say 'ok 1'
$P0 = new 'Exception'
throw $P0
say 'ok 2'
$P0 = new 'Exception'
throw $P0
say 'ok 3'
.end
What I'm trying to do is to test the ability to resume after
exceptions thrown by C<foo>. The C<main> sub above sets up
a handler to catch exceptions, then calls C<foo>. The handler
simply resumes any exception that is caught. The C<foo> sub
prints 'ok 1', throws an exception, prints 'ok 2', throws another
exception, and prints 'ok 3'.
I can resume the first exception but not the second:
$ ./parrot x.pir
ok 1
ok 2
No exception handler and no message
current instr.: 'foo' pc 46 (x.pir:20)
called from Sub 'main' pc 29 (x.pir:10)
$
Suggestions and corrections to my code welcomed.
Pm