From: Julian Fitzell Date: 2003-08-07T00:55:05+09:00 Subject: Re: Why does Ruby have callcc? james_b wrote: > 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 Well now, it's not that it doesn't scale - you just have to be careful how you let it scale. There are several useful deployed applications out there using Seaside. One in particular that Avi and I wrote has been running for a year and a half with almost no maintenance on our part. Now you're right that you probably wouldn't want to use it for a site that received millions of hits in a day, but you have a quite a bit of control over what state gets stored for backtracking and how many previous page views you want to keep around for a session, etc. You can definitely reasonably have a session kept under a couple of megs, which could give you hundreds of concurrent users on a box with a Gig of ram. Now I'm trying to remember the state of Borges (and the limitations of the basic part he ported back to ruby for that talk) and I can't really... so it may be that what he demoed didn't scale for some reason. So it's possible you're remembering correctly ;) Julian