Re: pseudo-specs for a String class

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Wed, 27 Aug 2008 11:28:18 -0600

On Wed, 2008-08-27 at 12:37 +0200, Kinkie wrote:
> > I had a long ranty email with lots of points, but I'll summarise and
> > save y'all the trouble.
>
> Thanks, I appreciate that.
>
> > A memory region can be manipulated (passed into vector IO, modified
> > with COW or not semantics, etc). Its just an array of bytes.
> >
> > A string includes things like potentially caring about character
> > encoding in things like length calculations, comparisons, etc. A
> > memory region doesn't. A string is generally a representation of
> > printable data; a memory region isn't.
> >
> > A string gets the benefits of a memory region (reference counting,
> > vectorised IO, etc) and just adds functionality on top of it.
> >
> > Would you use a "String" as the reference counted type for say, the
> > memory store?
>
> NOW I get the point :)
> To me a String is just an abstraction of a refcounted char*: it
> doesn't care about encodings etc.
> This is the cause of the whole misunderstanding: my implementation of
> a String is not a string at all, but more like a string-friendly blob,
> suited for low-level stuff such as for instance the memory store.
>
> Any suggestions for how should I rename the class? Would MemBlob sound
> good to everyone (let's keep it short, please)..

If your opaque memory class allocates and frees its own internal void*
memory buffer, call your class a MemoryBlob or MemoryChunk (MemBlob or
MemChunk are also OK).

If your opaque memory class class points to another class that manages
memory allocation, call your class a MemoryRegion or MemoryRange
(MemRegion or MemRange are also OK).

These classes should not have search- and interpretation-related
abilities.

FWIW, I would not expect the above classes to be used a lot until they
have a String class on top of them.

HTH,

Alex.
Received on Wed Aug 27 2008 - 17:29:10 MDT

This archive was generated by hypermail 2.2.0 : Wed Aug 27 2008 - 12:00:06 MDT