ImageSegments for real -- new VM / risky demo

Mark Guzdial guzdial at cc.gatech.edu
Thu Oct 7 15:07:45 UTC 1999


I'm trying to grok what's going on with the ImageSegments and how to use
them.  I tried this workspace code:

alpha := #('a' 'b' (12 34) 56 'c' 23.45).
is := ImageSegment new copyFromRootsLocalFileFor: (Array with: alpha).
is extract; writeToFile: 'alpha'

There was a perceptible pause while (I think) the imagesegment got stored
out.  I then went to check the value of alpha, and I heard the reading-in
sound.

- Does that mean that when alpha was written, the current value of alpha
was deleted from the image?  And it got read back in when I requested
alpha's value?  Which suggests that default behavior for the ImageSegment
stuff is to automatically provide a ImageSegmentRootStub?

- If I change alpha's value, how do I get the value written back out again?
Repeat the the ImageSegment code above, or is it done automatically?  My
experiments suggest the former, but since the on-disk ImageSegment access
seems almost invisible, it's hard to tell.

- How might I use the ImageSegment technology to store checkpoints of
state?  That is, set alpha to some value, write out the value as an
ImageSegment, use alpha some more with other values, and then later restore
alpha's value from the ImageSegment.

- I tried to use the new ImageSegment technology to finally be able to
write-out Wonderlands to share with others.  I tried this in a Workspace:
w := Wonderland new
"Do things with Wonderland, like load in Barney, er, Generic Purple
Dinosaur, then"
(ImageSegment new copyFromRootsForExport: (Array with: w))
		writeForExport: 'wonderland.extSeg'.

But I get an error notifier "Wrong state".  What might I be doing wrong here?

Thanks!
 Mark

--------------------------
Mark Guzdial : Georgia Tech : College of Computing : Atlanta, GA 30332-0280
(404) 894-5618 : Fax (404) 894-0673 : guzdial at cc.gatech.edu
http://www.cc.gatech.edu/gvu/people/Faculty/Mark.Guzdial.html





More information about the Squeak-dev mailing list