[Python-Dev] functional continuations

tomer filiba tomerfiliba at gmail.com
Sun Dec 16 09:26:21 CET 2007


yes, well, as i suspected and as PJE pointed out, extension or builtin
functions would
make life difficult, but these are difficulties i would be willing to
accept. however, my attempts
are futile anyways, as the evaluation stack is cleared before the exception
propagates up
to the frames above... which would explain the NULL deref exceptions i was
getting :)


-tomer

On Dec 16, 2007 12:54 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> tomer filiba wrote:
> > the idea i came up with is, using exceptions for functional
> > continuations: after all, the exception's traceback holds the entire
> > context...
>
> The problem with this is that, if the call chain has passed
> through a C-implemented function at some point, the traceback
> *doesn't* contain the entire context -- some of it is in the
> C stack frames that got unwound during the propagation of
> the exception.
>
> So you may be able to make this work where all the code
> involved is pure Python, but it can't work in general,
> unless you redesign the whole interpreter the way the
> original Stackless did.
>
> Having said that, it might still be a useful thing to
> have, as the pure-Python case is probably fairly common.
> But I'd want to know what the failure mode is like when
> the pure-Python case doesn't hold. Do you get a clear
> indication of what is wrong, or does it misbehave in
> some obscure way?
>
> A test case for this would be to call map() with a
> function that tries to suspend itself using this
> mechanism. What happens when you try to resume it?
>
> --
> Greg
>



-- 
An NCO and a Gentleman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20071216/72490810/attachment.htm 


More information about the Python-Dev mailing list