[E-Lang] Re: Upgrading old objects
Jonathan S. Shapiro
Wed, 28 Nov 2001 14:11:15 -0500
> In particular, Rather than having the object expression
> simply be lambda +
> message dispatch, We also bundled in the object's "name".
I think this is not quite what you want, though I too am uncertain of my
solution. Let me say a word or two about how CPCMS handles this problem.
First, we made two design decisions:
1. You have to be able to *read* older object versions
2. There needs to be a well-defined upgrade path.
In CPCMS the problem is simplified by the fact that we will probably
*never* need to refactor, but we will certainly need to add fields and
In anticipation of this, the first word of ever serialized object (or
first field, if XML-serialized) is a "type code". The type code uniquely
encodes both the object type and the version of that type. Really, it's
just a unique identifier for the type.
This way, the deserializer can apply needed "patches" when deserializing
Clearly this is not a sufficient solution for E, and you'ld probably
want to use cryptographic means rather than central assignment for type
encoding, but it does seem to be a necessary condition to any hope of
success in upgrade. At a minimum, I strongly urge making such a type id
be a standard part of the serialization protocol ASAP (if it isn't
already). The fewer objects you break inserting this, the better, so
sooner is better than later.