On Wed, Aug 27, 2008 at 8:04 PM, Henrik Nordstrom <[EMAIL PROTECTED]> wrote: > ons 2008-08-27 klockan 11:10 +0200 skrev Kinkie: > >> I'm unconvinced. What's the purpose of a MemoryRegion if you can't >> manipulate it? > > You can manipulate it, but at a rather low level. You can also append to > it by adding a MemoryRegion (or String), you can access raw octets. But > you can't do any fancier string family operations such as tokenising > based on separators, case-insensitive compare, substring search, etc... > > a MemoryRegion is binary data. > > a String is character data. > >> In C, it makes sense to provide different API: strings provide >> different semantics than char* (they're null-terminated). >> >> But here? >> Everything is bounds-safe or it's not worth the effort. >> NULL-termination is optional and only used when exporting the >> underlying data.. > > Strings have character properties. MemoryRegions not.
Er.. Except for documenting what each object is supposed to contain, I don't see much functional difference between MemRegion->memchr(char) and String->strchr(char) Let's also see things from the side of users: in most cases I expect we'll want to perform string manipulation (and thus need to typecast) on at least part of a MemRegion. It's not a problem tho.. I'll prototype the feature-rich user-facing class, then we split the interface in two and define what belongs to MemRegion and what belongs to a String (which we'll need to subclass to provide character-set-oriented semantics, but that's out of scope here). -- /kinkie
