[Seaside] Bug in Set backtracking

Bany, Michel mbany at cincom.com
Thu Oct 20 08:24:38 UTC 2005


In theory, if you need to correctly backtrack a complex compound object
you possibly need to re-implement #restoreFromSnapshot: #snapshotCopy

I found it generally quite difficult to correctly re-implement
these three methods where you need to understand how to play with
instance variables. There is an example on the VisualWorks distribution,
see the parcel named TowersOfHanoi. This example works but it is mostly
the result of trials and guesses, leading to write-only code.

I am now using a new technique for backtracking complex compound

Rather than coding :

	self session registerObjectForBacktracking: (workflow :=
Workflow new).

I am now coding :

	(workflow := Workflow new) registerForBacktrackingInSession:
self session.

where a typical implementation of #registerForBacktrackingInSession:
would be :

registerForBacktrackingInSession: aSession

	aSession registerObjectForBacktracking: self.
	aSession registerObjectForBacktracking: stack.
	undoLog registerForBacktrackingInSession: aSession.

You may want to try this technique with your test case.
I would be interested to hear how it works.


> -----Original Message-----
> From: seaside-bounces at lists.squeakfoundation.org 
> [mailto:seaside-bounces at lists.squeakfoundation.org] On Behalf 
> Of David Shaffer
> Sent: Wednesday, October 19, 2005 10:21 PM
> To: The Squeak Enterprise Aubergines Server - general discussion.
> Subject: Re: [Seaside] Bug in Set backtracking
> Avi Bryant wrote:
> >
> >
> >
> > I'm pretty sure that  you also need to override 
> #restoreFromSnapshot: 
> > to do a full #copy as well.  Otherwise after a restore, the 
> snapshot's 
> > internal state will #== the original's internal state, so that when 
> > you backtrack a *second* time you'll have issues.
> >
> > Avi
> >
> Ah yes, thanks.  Attached.  I also added another test case to 
> demonstrate this problem...
> David

More information about the Seaside mailing list