[fpc-pascal] Any recommendations for a good in-memory storage type

Marco van de Voort marcov at stack.nl
Wed Sep 22 13:31:57 CEST 2010


In our previous episode, Graeme Geldenhuys said:
> > I would first try a variant.
> 
> Just for getting the initial DND support to work under Xlib, I limited
> myself to text types only, so choose variant as my storage type, but
> now that I'm moving to the next phase (multiple data types), I am
> considering other storage types because I don't know if variant is
> suitable for binary data like sound, images etc..

No. But it allows you to keep text as text, not as streamed value. I don't
know if assigning a string to a variant is copy-on-write though.

If you don't operate much on it, it doesn't matter. But the above sounds
like you do most of the work on text, not binary blobs.

> I'm leaning towards
> TMemoryStream now. Just spotting the new incoming messages, Felipe and
> Michael seem to share my thoughts on that.

They didn't ask what you wanted to do exactly either :-)

variants support most base Delphi types, afaik including class , interface
and dyn array.



More information about the fpc-pascal mailing list