> I think I'd like these differently. STRING is a subclass of Buffer, > and the bufstart and buflen fields in Buffers point to the actual > start of memory and length of allocated data. I'd rather keep it that > way, and have the 'real' string length and string start be extra > fields in the STRING part.
Quote from http://www.mail-archive.com/perl6-internals@perl.org/msg09497.html: >The COWing of substrings requires a major interface change: >*** All references to the data in a STRING must use the new strstart pointer >instead of bufstart *** Actually, we don't. (Sez the man catching up on altogether too much mail) Since we're putting the COW stuff at the tail end, substrings of COW strings are fine. You set the bufstart to where the substring starts, buflen set so it goes to the end of the original buffer, and the string length bit holds the real string length. That way you start where you need to, but you can still find the COW marker off the end of the original buffer. [End quote] -- Peter Gibbs EmKel Systems