I recently re-read a lot of Paul Graham’s writings on lisp, and decided this time I was actually going to find out more about his concept of using closures to simulate web pages acting as subroutines (in Lisp in Web-Based Applications).
The two ‘definitive’ papers on the topic seem to be by Christian Queinnec: The Influence of Browsers on Evaluators or, Continuations to Program Web Servers, and Inverting back the inversion of control or, Continuations versus page-centric programming.
The basic concept is that thinking of a web site as a set of pages is the wrong approach – instead you should think of it as an extended computation, where interactions with users suspend the computation and later resume it. When implemented as continuations the compuation can be reified automatically.
This seems to be one of those subtle, but significant, changes in mindset that could change how you even approach building a major site.