Hi,

At Tue, 17 Dec 2002 17:43:24 +0900,
Matt Armstrong wrote:
> I'll try to understand this new string code, but I wonder if you could
> explain a few things.  My basic problem is that STR_ASSOC and
> ELTS_SHARED are not clear to me.
> 
> ELTS_SHARED -- means string shares same data buffer with some other
> string -- must make copy to modify.
> 
> STR_ASSOC -- I could not figure it out.

Related to Array#pack/String#unpack.  It means that the string
is made by pack("p")/pack("P") and contains pointer values of
packed objects.

> > +	!FL_TEST(str, STR_ASSOC)) {
> 
> And when the original string is not ??? (what is STR_ASSOC?)
> 
> > +	if (!FL_TEST(str, ELTS_SHARED)) str = rb_str_new4(str);
> 
> If the old string is ELTS_SHARED, create a new ELTS_SHARED string copy
> that is frozen.  Maybe I miss something here.

`If the old string is *not* ELTS_SHARED'.

Only one string not ELTS_SHARED is necessary for GC, and this
is the reason why I didn't make small string shared.
STR_ASSOC'ed string can't have reference to this non-shared
string, as it's used to refer associated objects.

-- 
Nobu Nakada