[Python-ideas] A Continuations Compromise in Python

John Graham john.a.graham at gmail.com
Tue May 5 04:01:58 CEST 2009


On Mon, May 4, 2009 at 8:11 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> John Graham wrote:
>
>> I believe it would be used for state that is not transferred via the
>> URL, such as a user's session with the server should some sort of
>> persistence take place.
>
> In that case you have a stateful server rather
> than a stateless one.
>
> But I still don't see how the proposed "continue"
> statement would help, because you don't want to
> call the continuation *now*, you want to defer
> it until later. So you still need to store it
> somewhere or return it to a trampoline.
>
> Seems to me a better structure for this would
> be to represent the session by an instance of a
> class, with methods corresponding to the various
> queries that can be sent. Then you've got much
> the same situation as with the stateless server,
> except that the mapping from query string to
> function goes through an intermediates step of
> locating the appropriate session object, based
> on a session id in the query. Still no need
> for continuations anywhere.
>
> --
> Greg
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>

In this case, continuation-passing-style would force capturing of this
state in the same way many 'functional-style' languages capture state,
immutable state in closures?  I can see how immutable state from
closures might have a benefit when back button and clone-tab buttons
are pressed, since there is no one grand object or class to refer to
per session, but more like little breadcrumbs of immutable state
between function calls.



More information about the Python-ideas mailing list