[Seaside] registerObjectForBacktracking, submit and execute b lock
mbany at cincom.com
Mon Aug 30 11:09:19 CEST 2004
This subject was already discussed here. See
I have actually fixed the problem with a bit of refactoring of the
snapshot logic by moving the snapshot behavior to Object.
I defined the following methods in Object
And I changed the following methods in WAStateRegistry accordingly
The default behaviour remains based on shallowCopy for the snapshot.
You may however re-implement the three Object methods as needed in
to use a deeper copy.
> -----Original Message-----
> From: seaside-bounces at lists.squeakfoundation.org
> [mailto:seaside-bounces at lists.squeakfoundation.org]On Behalf
> Of Andreas
> Sent: Sunday, August 29, 2004 2:44 PM
> To: The Squeak Enterprise Aubergines Server - general discussion.
> Subject: Re: [Seaside] registerObjectForBacktracking, submit
> and execute
> Ok, that makes sense, didn't know that it used an array internally.
> Any ideas of how to make backtracking work for adding /
> removing items
> from a collection?
> Somebody must have tried before ;)
> On 2004-08-29, at 12.29, radoslav hodnicak wrote:
> > On Sun, 29 Aug 2004, radoslav hodnicak wrote:
> >> Registering object for backtracking doesn't do what you probably
> >> think it does. It's only sensitive to changes of objects, *not*
> >> object's
> >> contents.
> >> holder := WAStateHolder new.
> >> holder contents: (OrderedCollection with: 1 with: 2).
> >> holder contents add: 3. "NO CHANGES HERE, STILL THE SAME OBJECT IN
> >> HOLDER"
> >> holder contents: (holder contents copyWith: 3). "NEW
> OBJECT IN HOLDER,
> >> WILL BACKTRACK"
> > Ok I didn't explain this good enough - backtracking works
> for changing
> > object state too - but it works on shallow copy so the
> changes it can
> > detect are only one level deep.
> > Take this example with OrderedCollection. The items are internally
> > held in
> > an array.
> > anOrederedCollection (object1)
> > --has anArray(items ...) (object2)
> > when you register object1 for backtracking, it makes a
> shallow copy of
> > it,
> > which means they share the same instance of object2. And on
> > it
> > looks whether object1 = object1 copy - and it does, because
> adding and
> > removing items changed the same array (object2). If you changed a
> > simple
> > instvar holding a string or whatever, then it would work as
> > Clear enough?
> > rado
> > --
> > gentleman, n. - a man who knows how to blog, but doesn't
> > _______________________________________________
> > Seaside mailing list
> > Seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/listinfo/seaside
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Seaside