On this page:

6.9 Object Serialization


(define-serializable-class* class-id superclass-expr
                                     (interface-expr ...)
  class-clause ...)
Binds class-id to a class, where superclass-expr, the interface-exprs, and the class-clauses are as in class*.

This form can only be used at the top level, either within a module or outside. The class-id identifier is bound to the new class, and deserialize-info:class-id is also defined; if the definition is within a module, then the latter is provided from a deserialize-info submodule via module+.

Serialization for the class works in one of two ways:

In the second case, a serializable subclass can implement externalizable<%>, in which case the externalize method is responsible for all serialization (i.e., automatic serialization is lost for instances of the subclass). In the first case, all serializable subclasses implement externalizable<%>, since a subclass implements all of the interfaces of its parent class.

In either case, if an object is an immediate instance of a subclass (that is not itself serializable), the object is serialized as if it was an immediate instance of the serializable class. In particular, overriding declarations of the externalize method are ignored for instances of non-serializable subclasses.


(define-serializable-class class-id superclass-expr
  class-clause ...)
Like define-serializable-class*, but without interface expressions (analogous to class).

The externalizable<%> interface includes only the externalize and internalize methods. See define-serializable-class* for more information.