Piers Cawley <[EMAIL PROTECTED]> wrote: > So, I'm trying to get my head 'round parrot's continuations. It's my > understanding that, at creation time, a Continuation closes over the > current user stacks, control stack and lexical pad (and possibly some > other stuff but those'll do for now).
Yes register stacks. Which is one problem of your code. The calling sequence has a "savetop" inside, which isn't in the Continuations context. I already posted an working example. Here is another one (comments indicate problems with your code: .sub main $P0 = new PerlUndef $P0 = "Howdy, world\n" save $P0 # create continuation inside, so that it has this in context savetop $P1 = newcont after P5 = $P1 P0 = find_global "_invoker" invokecc after: restoretop restore $P2 print $P2 end # end *is* needed in main .end .sub _invoker # ^^ global labels have an underscore .param pmc a_cont invoke a_cont .end > Weird hunh? As long as no one really can tell the semantics of Continuations, they have to be hand-crafted like above. leo