[Seaside] StateHolders and complex objects -djb

Avi Bryant avi at beta4.com
Sat Feb 8 11:35:57 CET 2003

On Sat, 8 Feb 2003, Derek Brans wrote:

> Avi, Julian,
> Are stateholders able to manage collections?  Do attributes on objects
> in the collection get rolled back?
> In general, if a stateholder maintains some complex object, what aspects
> of that object get rolled back?


The point of StateHolder (as opposed to the various other state rollback
schemes I've used) is that the semantics are very clear and very simple.
There is only one value that changes automatically, and that is the
#contents of the StateHolder: which object it is holding on to.  No state
in the object its pointing to is changed at all.

If you want to maintain a Collection in a StateHolder, I recommend you do
it functionally - with no mutation.  For example,

  foo := session stateHolder contents: #().

addToFoo: anObject
  foo contents: (foo contents copyWith: anObject)

removeFromFoo: anObject
  foo contents: (foo contents copyWithout: anObject)

More information about the Seaside mailing list