The last (and never done correctly) relict of old calling conventions...

Technically an excpetion is kind of an object with some info (TODO) and the exception handler is a (limited) continuation:

  pmclass Exception_Handler extends Continuation ...     # see classes/

Throwing an exception is calling an exception handler and delivering results. This is the same as invoking a continuation. See e.g. t/op/calling_48.pir or t/op/lexicals_29.pir.

Which means that we need:

  catch_label:
      get_results "(...)", Pexcept, Smessage, ... # whatever

or in PIR speak, the left hand side of a sub call;

(ex, mess, ...) = catch_label # the RHS is just a label or the handler ...

(the left side - the results part - is that where continuations are branching to - strange isn't it?)

And the opcode

   push_eh catch_label

is creating the Exception_handler with the 'get_results' in it's context, so that it can deliver results.

Just a brain dump before I forget it ;-)
Detailed syntax bits welcome ...

leo

Reply via email to