On Thu, Aug 29, 2002 at 07:52:42AM -0700, Steve Canfield wrote: > From: Dan Sugalski [EMAIL PROTECTED] > >I actually had something a bit more subversive > >in mind, where the assignment operator for the > >Date class did some magic the same way we do > >now when we do math on strings. > > I was thinking a simple general purpose rule. If the variable is > typed, and its class has a standard static method for > instantiating from a string, and if a String object is being assigned > to the variable, then the class's deserialization method is called, > returning the new object and assigning it to the variable.
This is possibly more an internals question, but I was assuming that the serialization/deserialization methods would normally be converting an object to an efficient packed 8 bit binary serial format (much like Storable does). In which case, is it a counterproductive assumption to expect (or mandate) that the incoming serialization method on a class accepts well formed human readable Unicode (or Shift-JIS or ASCII or whatever) strings? Surely a class is allowed to make a distinction between the format that it uses to serialize itself, and the format(s) of initialization strings it accepts? Nicholas Clark