On Tue, Apr 1, 2008 at 2:37 PM, Patrick R. Michaud <[EMAIL PROTECTED]> wrote:
> On Tue, Apr 01, 2008 at 01:23:38PM +0200, Klaas-Jan Stol wrote:
>  > in the exception handler, a new Undef is created in $P0. When leaving
>  > this line, this code won't work. When commenting out this line, it
>  > will print "hi", as expected.
>  > I don't get that, because, 3 lines later, a new object is stored by
>  > name "lex"; I had expected to overwrite the current object by that
>  > name.
>  >
>  > [...]
>
> >
>  > .sub main
>  >    push_eh exc
>  >    foo()
>  >    pop_eh
>  >    .return ()
>  >
>  >  exc:
>  >    $P0 = new 'Undef'
>  >    .lex "ex", $P0
>  >    .get_results($P1, $S0)
>  >    store_lex "ex", $P1
>  >    find_lex $P2, "ex"
>  >    print $P1
>  > .end
>  >
>  > .sub foo
>  >    $P0 = new 'String'
>  >    $P0 = "hi"
>  >    throw $P0
>  > .end
>
>
>  I think that .get_results() has to be the _first_ instruction
>  executed as part of an exception handler.  When I change the
>  exception handler to the following seems to work just fine:
>
>   exc:
>     .get_results($P1, $S0)
>
>     $P0 = new 'Undef'
>     .lex "ex", $P0
>
>
>     store_lex "ex", $P1
>     find_lex $P2, "ex"
>     print $P1
>
>  Pm
>

yes, I think you're right. thanks for this info.

declaring a .lex before this .get_results instruction is allowed,
though. This is a bit confusing: some directives (such as
.get_results) are mapped to instructions, while .lex is just a
directive. If they're just directives, they're allowed.

kjs

Reply via email to