From: Mike Gold Date: 2009-03-03T12:38:50+09:00 Subject: Re: Marshal.load does not create new instances? Robert Klemme wrote: > > I believe he wants to evolve the class and be able to load data > written with an older (or just different) version of the class. And > now Ian hits the usual problems of schema migration. > > Ian, you should be aware of one thing: class definitions are not > serialized - no programming language that I know does this. ... except languages in which code and data are equivalent! Sorry, I had to bite. This is a great example of the power of code-data equivalence. If you store the definitions, things will just work. I see no immediate reason not to do it, other than the language not letting you (short of awkward contrivances like heredoc-ing all your code). If you expect the definition to change, you can write adapters which examine the definition (since it's data!) to detect new or incompatible changes then adjust accordingly. > And there are probably good reasons (security, efficiency probably). There are a variety of reasons for both doing it and not doing it. One reason for not doing it is that the language you chose does not allow you to do it. That may or may not be a good reason. In case there was any confusion from a previous thread, I do use ruby, as is obvious from my previous posts. I would only suggest that working around the limitations of a language is not necessarily the best approach, even though it is typically the default course of action. In some cases it might be better to use a language without those limitations. -- Posted via http://www.ruby-forum.com/.