http://en.wikipedia.org/wiki/Continuations
Continuations allow people to map web application workflows using single code blocks, where the flow is interrupted at times when user requests are needed and the current state of the code block is saved using a continuation.
This is currently not supported in Ruby On Rails
Further Warning: All of this stuff below is probably crap!
[Confirmed, description below is crap, and entirely misses an important motivation for continuations in web servers: to enable server-initiated ‘events’ without polling, by allowing client requests to stay open without consuming a blocked thread on the server, a la Comet]
Try this instead, it’s no call/cc but can do almost the same as the code below: http://github.com/boof/action_sequence/tree/master
Here is an example of pseudo code of how this might work :
class CartController < ApplicationController
continuations :only => [:checkout, :shipping_address]
def checkout
@cart = Cart.find_by_user(current_user)
redirect_to :action => "show" unless @cart.verify
continue_to :action => shipping_address
if continuation[:needs_billing]
continue_to :action => billing_address
continue_to :action => credit_card
continue_to :action => confirm_order
#When the controller reached the end, it would render the checkout page, which would nullify back button support among the continuationed pages.
end
def shipping_address
end
# Other Actions below here not listed
end
the point of this
You can program page flows explicitly, without having to mess with session variables. Things look very clean. You should be able to support arbitrary branching, arbitrary number of browsers from the same session, and still have the back button work (when it can work)
How does it work?
Forthcoming