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

Re: Demystifying Continuations




From: "David Simmons" <David.Simmons@smallscript.net>
> 
> So you have a choice. You can implement continuations with inconsistent 
> behaviour by having it do two things:
> (a) within the current thread, unwind back to the continuation frame
> (b) within another thread, don't unwind, but jump straight to the 
> continuation frame.

I would argue that this is not inconsistent.

Each thread is a virtual machine, and within that thread the
continuations unwind.  When switching threads, you are creating
the illusion of multiple execution units by time-division
multiplexing.  If you literally had 100 processors, you wouldn't
actually be switching threads:  each would be running simultaneously,
and you wouldn't expect to see unwinds happening.

An interesting thing here:  it seems to make no sense to me
to invoke a continuation captured in another thread (or on
another virtual machine).