Quote Originally Posted by Chebmaster
A interesting idea. But the implementation... Um... The horrors like IntToStr() and a performance do not get along too good.

With all my respect to the author of this article, I believe I did solve the same problem better (see https://sourceforge.net/projects/chepersy/ ). It's a custom replacement for the Delphi streaming system. Needs to list all the object's field in a special method, but everything else is automatic. *and* it's optimized for speed.

Currently I am working on the forward compatibility, so that the older programs will be able to read the newer data files that contain new object classes unknown to them.
Hi Chebmaster,

I'd really just like to say that the article is intended to illustrate the use of TObject.methodAddress. This can be a pretty useful little trick that a lot of people may not have encountered before.

The vehicle for this is my basic versioned data store. It is simple and effective and above all illustrates the use of TObject.methodAddress quite well. Whether it provides an optimal solution depends on what qualifies as optimal... in the context of a game where it is used to load game data, map data and game saves, its load and save times are more than acceptable... the files sizes are quite small because it has no additional type/class information and if your idea of optimal involves code size and complexity then I would suggest its right up there because its quite small and easy to understand... even for beginners.

With regards to other solutions to versioned data storage... there are other options (a fact I stated in the article), but... I've tried one or two and I didn't get on very well with them. So, I wrote my own and have used it as the basis for this article with the intention of helping others learn a little more about our favourite language.

Thanks for reading and thanks for the comments.