Re: pseudo-specs for a String class

From: Henrik Nordstrom <henrik_at_henriknordstrom.net>
Date: Wed, 27 Aug 2008 23:51:56 +0200

On tor, 2008-08-28 at 01:25 +1200, Amos Jeffries wrote:

> I read your definitions of memory buffer (simple case) and string
> (complex case) as being definition of two separate non-interchangeable
> things:

In my world they are fully interchangeable when you (as the programmer)
know the data referenced is..

String is a subclass of MemoryRegion. Every String is also a
MemoryRegion, and a MemoryRegion (in full or part thereof) can trivially
be casted into a String when needed (may create a new String object, or
if full reference cast the MemoryRegion into a string in-place, doesn't
really matter).

However, the day String has encoding knowledge array semantics may
differ from MemoryRegion. But that's not yet on the agenda and perhaps
never even needed.

> "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."
>
> ... particularly that last sub-sentence

What about it?

> Yes. I would. I really don't like Java, but their object serialization
> concept can be made very efficient for specific cases like HTTP Header
> storage. Completely removing any duplicate parsing (speed!) on load of
> object bytes from disk etc.

I don't get why this makes the stored data a String.. storing ints or
pointers binary in a string is, well.. odd.. MemoryRegion is a exact fit
for this kind of serialized data.

> > Hm, Alex/Duane/Robert/Henrik, what did Whale call all of this? I
> > thought this was one area that was "done" and gels pretty well with
> > what we've since learnt..

Memory has faded, but I don't think the shared whale repository ever got
a String..

My little toy classes from the ealy discussions did have a primitive
String class, but implementation far from complete and not very sanely
done OO-wise.

Regards
Henrik

Received on Wed Aug 27 2008 - 21:52:05 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 28 2008 - 12:00:08 MDT