abusing exceptions for continuations

Paul McGuire ptmcg at austin.rr.com
Mon Dec 10 14:18:36 EST 2007


On Dec 10, 2:39 am, gangesmaster <tomerfil... at gmail.com> wrote:
> i've had this strange idea of using the exception's traceback (which
> holds the stack frame) to enable functional continuations, meaning,
> raise some special exception which will be caught by a reactor/
> scheduler/framework, which could later revive it by restoring the
> frame.
>
> i'm thinking of using the generator's implementation (some minimal
> support on the c-side)
>
> has this been tried before? what were the results?
>
> thanks,
> -tomer

Simpy has a mechanism like this, for discrete event simulation
modeling of processes and resources.  Processes "run" for a while,
then yield a delay or a hold on a resource, and are resumed later.

-- Paul



More information about the Python-list mailing list