I'm iworking on a patch for Perl 5 that implements the Perl 6 closure
traits (ENTER/LEAVE/...) as special blocks. There are several details
that aren't clear to me from either S04 or the spec tests; I apologize
if these have been discussed before, as I haven't been following p6l.
I'm also not subscribed, so if people could keep me in the CC that would
be appreciated.

- Presumably when an exception is thrown through a block, the LEAVE and
  POST queues are called (in that order). What if a PRE block fails: is
  the POST queue on the same block called? (Do you have to satisfy your
  post-conditions even if your pre-conditions failed?)

- If a POST block is called as a result of a thrown exception, and it
  fails, which exception 'wins'?

- Presumably if an ENTER block dies, the rest of that ENTER queue is
  abandoned. Does that also apply to the LEAVE queue? What should

        LEAVE { say "leave1" }
        LEAVE { say "leave2"; die "foo"; }

  print? Similarly POST: once one post-condition has failed, are
  subsequent post-conditions checked?

- Can a try block catch an exception thrown from its own ENTER or LEAVE
  queue? For example in this case:

    try {

        try {
            ENTER { die "foo" }
            CATCH { default { say "caught inside" } }

        CATCH { default { say "caught outside" } }

  which CATCH block gets the exception? What about PRE/POST: can you
  CATCH failure of your own pre-/post-conditions?

- Does it make any difference in any of the above if 'die' is replaced
  by 'exit'?


Reply via email to