I ran into this in graydon's diary:
I have an ongoing thesis at the moment which I'm exploring in the programming language literature, which is that programming language features do well (all other things being equal) when they eliminate either distant or dynamic state and replace it with either close or lexical state. the underlying point being that we may favour language features that facilitate copying and modifying small bits of code -- fragments which work in their new context -- as a fundamental programming activity.
I wonder if this is a good way to explain some of the benefits of Seaside's approach to web-app session management. Because Seaside lets you describe multi-page sequences in one block of code, a lot of state that would normally have to be stored in some kind session object can simply be in local variables. For example, shopping cart checkout code can look something like this:
|customer shippingAddress billingAddress| customer := self loginCustomer. billingAddress := self getBillingAddress. [self requiresSeparateShippingAddress] ifTrue: [shippingAddress := self getShippingAddress] ifFalse: [shippingAddress := billingAddress]. self processOrderFor: customer billTo: billingAddress shipTo: shippingAddress.
If you're unfamiliar with Smalltalk syntax, the || at the top is a set of local variable declarations.
I often talk about the fact that it's much more maintainable to have this entire flow in one chunk of code, but I don't tend to dwell on the locality of state too much. Perhaps I should.