Another good thing to read about continuations is the continuation chapter of<div><br></div><div><a href="http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/">http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/</a></div>
<div><br></div><div>Here's my short take on "why" continuations for the Web:</div><div><br></div><div>* Due to HTTP's stateless nature, Web clients must "remind" Web servers of what the server was doing for the client. In any context, "what was going to happen" is the continuation of the computation.</div>
<div><br></div><div>* There are three ways to capture a continuation: incorrectly, correctly (manually), and correctly (automatically).</div><div><br></div><div>-- Incorrectly is what most people due by assigning a "session" id that makes it so each client can only be doing one thing and that thing is stored on the server and referenced by an identifier held by the client. This is incorrect because Web browsers can have many pages open, use the Back button, etc AND because storing things on the server like this increases resource usage.</div>
<div><br></div><div>-- Correctly (manually) is what most simple Web programs do. The programmer breaks up each step of the computation into a different PHP file (or function) and painstakingly records the environment of that step in hidden form values, URL parameters, etc. This manual process is difficult, error-prone, and frustrating, because it is so sensitive to the particular computation and almost entirely administrative labor.</div>
<div><br></div><div>-- Correctly (automatically) is what the Racket Web server provides: you write your application as if HTTP were stateful and it compiles (or runs) it using the constraint of real HTTP. You never need to think about what is left to do, what free identifiers there are, etc.</div>
<div><br></div><div>* Basically, continuations make Web programming like normal programming on the console. You don't really need to know anything special. It's the hardest for people who have used other Web frameworks because almost everything they do is now unnecessary, so you keep thinking that you need a way to make a "session" (or something) and you'll never see one.</div>
<div><br></div><div>That said, the Racket Web server does not force you to use these features. You can "program Fortan in any language" and write a PHP program. You make prefer Racket-PHP to normal PHP, but some things will be annoying, like having to bake your own session management. I find that most Racket apps use continuations directly in very few situations (multi-page forms) but mainly use the ability to bind a closure to a link a lot (although this features needs continuations inside its implementation). [This is the difference between send/suspend and send/suspend/dispatch... roughly.]</div>
<div><br></div><div>Jay <br><br><div class="gmail_quote">On Mon, Dec 12, 2011 at 2:40 AM, Gerry Weaver <span dir="ltr"><<a href="mailto:gerryw@compvia.com">gerryw@compvia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Neil,<br>
<br>
Thanks for the link. It was VERY helpful. It does answer the "why" part of the question, but not necessarily the "if" part. I'm thinking in terms of a real world application and it's maintainability. It seems while a particular problem was solved, the bar on the price of entry to the code was raised significantly. If the problem were to be solved in a way that would maintain a more conventional design, it would be accessible to a wider range of developers. There are many that struggle with understanding continuations (myself included). I was just trying to compare the benefits of a continuation based design versus a more conventional approach. At this point, I still think it would depend heavily on the specific use case and developer skill level. Don't get me wrong. It's very cool! However, if the goal were to make scheme based web development accessible to the masses, I don't think a<br>
continuation based design would be the right choice. I will continue to ponder this question as I become more proficient in the language. I think it is important to capture these kinds things when learning any new language. It's a moment that will never come again. It seems I will inevitably reach a point where I am no longer able to evaluate things like this objectively. <br>
<div class="im"><br>
<br>
Thanks,<br>
Gerry<br>
<br>
-----Original Message----- <br>
> From: "Neil Van Dyke" <<a href="mailto:neil@neilvandyke.org">neil@neilvandyke.org</a>><br>
</div><div class="im">> To: "Gerry Weaver" <<a href="mailto:gerryw@compvia.com">gerryw@compvia.com</a>><br>
> Cc: <a href="mailto:users@racket-lang.org">users@racket-lang.org</a><br>
</div><div class="im">> Date: 12/12/11 02:41<br>
> Subject: Re: [racket] Racket Web Server<br>
><br>
</div><div><div></div><div class="h5">> Gerry Weaver wrote at 12/12/2011 02:29 AM:<br>
> > What exactly are the benefits of a continuation based design?<br>
><br>
> Does this paper address your questions?<br>
><br>
> Krishnamurthi, Hopkins, McCarthy, Graunke, Pettyjohn, Felleisen,<br>
> "Implementation and Use of the PLT Scheme Web Server",<br>
> Journal of Higher-Order and Symbolic Computing<br>
> <a href="http://www.ccs.neu.edu/racket/pubs/#hosc-07" target="_blank">http://www.ccs.neu.edu/racket/pubs/#hosc-07</a><br>
> <a href="http://www.ccs.neu.edu/racket/pubs/hosc07-sk-mf.pdf" target="_blank">http://www.ccs.neu.edu/racket/pubs/hosc07-sk-mf.pdf</a><br>
><br>
> --<br>
> <a href="http://www.neilvandyke.org/" target="_blank">http://www.neilvandyke.org/</a><br>
<br>
<br>
<br>
<br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Jay McCarthy <<a href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>><br>
Assistant Professor / Brigham Young University<br><a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br><br>"The glory of God is Intelligence" - D&C 93<br>
</div>