"Simon Wright" wrote in message news:x7visw62wwu.fsf@smaug.pushface.org... > Stephen Leake writes: > > > Rodrigo Garc�a writes: > > > > > One solution is to do custom serialization but, does anybody knows > > > of an Ada compiler that can automatically serialize the objects > > > pointed by access variables (recursively if needed, such in the case > > > of the linked list)? > > > > This is not possible in general. How would the compiler resolve a > > circular list? All doubly-linked lists have circles, so it is a real > > problem. > > Clearly this can be done! Java does it (unless I'm mistaken). You have > to keep track of what's been serialized already, I suppose. Java serialization is actually a bit more complicated than you imply. Only the classes that implement the Serializable interface may be serialized. Java classes that need to control the serialization process have several possible approaches. The first approach is to override the readObject() and writeObject() methods. These methods allow pre and post processing to be done for the serialization process. The second, and more powerful approach, is to implement the Externalizable interface, which extends the Serializable interface. All classes are tested by the serialization mechanism to determine if they implement the Externalizable interface. This interface declares two methods: readExternal() and writeExternal(). These methods are often used to perform encryption, or handle other algorithms, including writing data in a special format. Jim Rogers