[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: So, what the heck is a continuation anyway?



>>>>> "DS" == Dan Sugalski <dan@sidhe.org> writes:

  DS> can I get a continuation object/marker from within A and pass it
  DS> to B, which then triggers it and returns to A even though I've
  DS> unwound the stack frames for A?
  >>
  >> Sure.
  >>
  >> You can invoke the continuation and return through A an arbitrary
  >> number of times.

  DS> Hmmm. That means I need to snapshot the stack frames and the
  DS> scratchpads.  Doable.

The problem we run into with Python is that there are so many places
where C stack frames get intermingled with a chain of Python stack
frames:  All of the operator overloading (special methods like __eq__)
dispatch through a C function call.  Builtin functions like map are
implemented in C.  Extensions modules written in C can invoke Python
code at arbitrary times -- say in a Tk callback.

Jeremy