From: Gary Wright Date: 2009-03-01T07:42:26+09:00 Subject: Re: Marshal.load does not create new instances? On Feb 28, 2009, at 3:50 PM, Ian Trudel wrote: > We should perhaps see the problem as if it was extreme: let's imagine > that we have multiple programs which have each a class Data but is > completely different (no similar instance variables nor methods, > nothing > in common at all). No access to those programs and yet have to load > all > the files within a single Ruby program. What one would do? You are establishing ground rules that can't be followed. If you have two programs that want to exchange data then they've got to have some pre-existing *shared* understanding of the structure of the data. You can't migrate the state of an object from one arbitrary class to another arbitrary class without constraining the form of that state in some way. Ruby's marshal has a built-in assumption that the class that loads the object state is the *same* (for some reasonable definition of "same") as the class that dumps the object state. It's sounds to me like you need to abstract out the state into its own class and use Marshal to serialize/deserialize that and then devise import/export methods for the various 'versions' of your Data class. Use an intermediate class to act as the adapter between all the versions of your Data class. Gary Wright