From: james_b Date: 2003-08-06T22:38:09+09:00 Subject: Re: Why does Ruby have callcc? Brian Candler wrote: > On Wed, Aug 06, 2003 at 08:38:25PM +0900, Harry Ohlsen wrote: > >>I'd be interested to read about some real-world examples where people have >>used callcc, not just to try it out, but because it was the "right" way to >>do something (for efficiency, or code brevity or whatever reason). > > > I think Seaside/Borges falls into this category. > > I haven't had a chance to use it in anger, but I think the idea is that > continuations can represent CGI session state; you code can be written in a > linear fashion (e.g. display page, fetch response, display next page, fetch > next response etc) without any explicit session maintenance. Furthermore, by > retaining continuation objects which represent earlier pages, it will work > even if the user clicks 'back' in their browser and re-enters data in a > previous form. > > I'd have a number of concerns in a practical application - I'd want old > continuations to expire and be garbage-collected so that they don't cause > infinite memory growth - but otherwise it sounds like a great way to write > web applications. As I recall from RubyConf 2002, the use of continuations in Borges was elegant but did not scale. Tracking all that previous state gets expensive. Perhaps see Avi Bryant's presentation slides: http://www.zenspider.com/Languages/Ruby/RubyConf2002/index.html James > > Regards, > > Brian. > >