I'm a bit confused on how lexicals are supposed to work. Below is a
simple example, which looks more or less on code generated by PCT for
a try/catch statement.

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.

Where do I go wrong?

kjs

======================

.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

Reply via email to