Persistant (as in on disk) data

Ketil Z Malde ketil@ii.uib.no
08 Mar 2003 21:24:53 +0100


"Simon Marlow" <simonmar@microsoft.com> writes:

> No, the GHC version *is* endian-independent.  But it's not word-size
> independent, so moving a binary file from a machine with a 32-bit Int to
> a machine with a 64-bit Int won't work (unless you avoid Int and stick
> to fixed-size types and Integer).

Appears to me that 64 and 32 bit Ints are going to cause trouble no
matter what, since a 32 bit Int may overflow on reading a 64 bit Int -
I don't see how they can be made compatible.

I'm not sure this is important.  I think (deriving) Binary should only
be used for temporary storage when you have complete control over both
ends (e.g. messages in a distributed application), not for storing
state to disk.  Small changes to the program will almost ceratinly
break it, and being able to cope with previous versions will lead to
all kinds of maintenance headaches.

Much better with a well specified format, and apporpriate Read/Show
classes (or similar).  Which as a bonuus gives you a human-readable
format. 

This is based on my (bad) experiences with MFC's Serialize
functionality, perhaps Binary is better.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants