Discussion:
Island class>>checkpoint:
Takashi Yamamiya
2005-11-10 12:38:56 UTC
Permalink
Hi,

I'm learning about Tweak Island with playing
http://tweak.impara.de/TECHNOLOGY/Whitepapers/Islands/. However,
Island class>>checkpoint: seems not to be in latest Tweak image, then I
couldn't see how it works. Is #checkpoint: no more supported?, or are
there any alternative ways of saving status of an island?

Cheers,
Takashi
Bert Freudenberg
2005-11-10 15:16:23 UTC
Permalink
Post by Takashi Yamamiya
Hi,
I'm learning about Tweak Island with playing
http://tweak.impara.de/TECHNOLOGY/Whitepapers/Islands/. However,
Island class>>checkpoint: seems not to be in latest Tweak image, then I
couldn't see how it works. Is #checkpoint: no more supported?, or are
there any alternative ways of saving status of an island?
You should use IslandWriter's #snapshot: method now. We renamed the
method to be more conform to Smalltalk terminology (checkpoint is
from E).

- Bert -
Takashi Yamamiya
2005-11-11 16:32:34 UTC
Permalink
Thank you, Bert!

Finally, I can save/load an island like that.

[ "Example: Checkpointing and restoring an island"
| island other varA varB data writer |
island := Island named: 'example'.
varA := island new: TestVariable.
varA value: 'Hello World'.
island at: #var put: varA.

"Now snapshot"
data := ReadWriteStream on: ByteArray new.
writer := IslandWriter new snapshot: island.
writer saveObjectOn: data.
data reset.

"And restore"
other := IslandReader new readObjectFrom: data.
varB := other at: #var.

Transcript cr; show: 'The value of the restored variable is: ', varB value printString.
]

Althogh, I needed to fix #objectVersionID and #archiveVersionID at
IslandWriter/IslandReader because these are defined like;

archiveVersionID
^self subclassResponsibility

When I put ^ UUID fromString: something instead of
subclassResponsibility, above code worked. But I wonder why do
those methods signal subclassResponsibility? Do I need to make some
subclass?

Cheers,
Takashi
Post by Bert Freudenberg
Post by Takashi Yamamiya
Hi,
I'm learning about Tweak Island with playing
http://tweak.impara.de/TECHNOLOGY/Whitepapers/Islands/. However,
Island class>>checkpoint: seems not to be in latest Tweak image, then I
couldn't see how it works. Is #checkpoint: no more supported?, or are
there any alternative ways of saving status of an island?
You should use IslandWriter's #snapshot: method now. We renamed the
method to be more conform to Smalltalk terminology (checkpoint is from E).
- Bert -
Loading...