in reply to Re: Force caller to return - reflection
in thread Force caller to return - reflection

What I want to do isn't sane in the general case, but it is sane for the specific case of how the module works. :) Scope::Upper looks like it's designed to manipulate scoping rules - unwind() doesn't actually impact program flow. What I'm looking for is something a bit more like "pretend you're doing tail recursion and pop the call stack twice rather than once, returning this value". Thanks for the idea though.
  • Comment on Re^2: Force caller to return - reflection

Replies are listed 'Best First'.
Re^3: Force caller to return - reflection
by Corion (Patriarch) on Jan 20, 2009 at 14:26 UTC
      Interesting! I'll have to see if that can be nicely wrapped to do what I want. Thanks.
Re^3: Force caller to return - reflection
by Prof Vince (Friar) on Jan 24, 2009 at 11:40 UTC
    unwind() doesn't actually impact program flow
    Oh yes it does. Just how do you think you can return values from an upper scope without restarting from there? Not mentioning that that would be of very limited use if it didn't!

    Continuation::Escape gives an alternate interface to it, which effectively relieves you from having to specify the target context yourself. But OTOH it requires you to be able to "mark" the context you want to return to. Reading its source code will surely teach you how it builds up on unwind.