473,378 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

abusing exceptions for continuations

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
3 1109
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andrew | last post by:
Hi, To satisfy my curiosity I was wondering if anyone knew if this behaviour was intentional? Is there a specific reason why exceptions are not allowed to be new style classes? Python 2.3...
59
by: kk_oop | last post by:
Hi. I wanted to use exceptions to handle error conditions in my code. I think doing that is useful, as it helps to separate "go" paths from error paths. However, a coding guideline has been...
6
by: vasudevram | last post by:
Hi, I am Googling and will do more, found some stuff, but interested to get viewpoints of list members on: Continuations in Python. Saw a few URLs which had some info, some of which I...
26
by: gnuist006 | last post by:
Again I am depressed to encounter a fundamentally new concept that I was all along unheard of. Its not even in paul graham's book where i learnt part of Lisp. Its in Marc Feeley's video. Can...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.