At 11:11 AM -0700 5/21/02, Steve Fink wrote: >On Tue, May 21, 2002 at 01:38:45PM -0400, Dan Sugalski wrote: >> At 5:27 PM +0000 5/21/02, "Peter Gibbs" (via RT) wrote: >> > > 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] >> >> Either I was thinking of something else, or being rather stupid >> there. Either way, it seems inappropriate for what you're >> doing.Leaving the Buffer bits to point to the real buffered data and >> leaving the string bits to do all the magic twiddly substring bits >> seems more appropriate at the moment. >> -- > ><ouch> That's exactly what Peter's original COW patch did. It was >called strstart.
Yeah, I wasn't happy about having an extra field in each string for the real start of string data (as opposed to the start of the buffer) so I was thinking we'd only do COW for a subset of strings. At this point I've given in--it's an extra pointer per string, but we're chewing up gobs of memory anyway so I'll cope. :) -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk