Fixing up state after error

Joshua 'Schwa' Gargus schwa at cc.gatech.edu
Tue Aug 19 18:56:31 UTC 2003


Hi,

I'm pretty sure that that there's a way do what I want, but I can't
find it.

Here's a simplified version of my problem: I have an object that wants
to save itself on a ReferenceStream in response to #writeToFile, but
it has some property stored in an instVar named 'prop' that I don't
want stored (I later store it separately).

I have something like:

writeToFile
	| propHolder |
	ref := ReferenceStream on: (FileStream fileNamed: 'output.obj').
	propHolder := prop.
	prop := nil.
	ref nextPut: self.
	prop := propHolder


I want to assure that if something goes wrong during stream writing, and
triggers a walkback, that 'prop' gets restored to its old value.  I'm 
pretty sure I saw somthing like this recently in the image, but can't
remember where.

Thanks,
Joshua



More information about the Squeak-dev mailing list