By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,341 Members | 1,395 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,341 IT Pros & Developers. It's quick & easy.

abusing exceptions for continuations

P: n/a
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
Dec 10 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
gangesmaster a écrit :
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?
I don't know, but you may want to have a look at Stackless Python.
Dec 10 '07 #2

P: n/a
On Dec 10, 2:39 am, gangesmaster <tomerfil...@gmail.comwrote:
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
Dec 10 '07 #3

P: n/a
On Dec 10, 5:39 am, gangesmaster <tomerfil...@gmail.comwrote:
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
That idea has been tried here http://aspn.activestate.com/ASPN/Coo.../Recipe/474088

It fails with algorithms which not use tail call recursion, and is
veeery slow. Try with Stackless.

Lautaro
Dec 11 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.