[plt-scheme] Saving and loading an instance of a class (boardgame)

From: Noel Welsh (noelwelsh at gmail.com)
Date: Mon May 17 05:33:00 EDT 2010

Make  your class serializable:
>
> Can we print current-game to a file with a command such as:
>

http://doc.plt-scheme.org/reference/objectserialize.html?q=serialize

and then you can use serialize/deserialize to save and load instances
of your class.

> Is it possible to ... refer to the instance itself?

this is bound to the instance, and this% to the instance's class.

> Will the loading get screwed up with we change a minor thing in the
> game%-class?

Probably. If you want to avoid this you should implement your own
serialization routine using the externalizable<%> interface.

N.


Posted on the users mailing list.