[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    WIlderness::  Why do strings when created also seem to create a SHARED
From:       "Charles E. Thornton" <ruby-core () hawthorne-press ! com>
Date:       2005-08-27 5:26:00
Message-ID: 430FF913.6020600 () hawthorne-press ! com
[Download RAW message or body]

While exploring the ELTS_SHARED flag, I  would think the shared object 
would only be created
when a string was modified and had more than one reference refering to it.

But it seems that whenever you do this for example
      a = "content"

This is created:
OBJ1:  basic.flag |= ELTS_SHARED
            ptr -> "content"
            len -> 7
            aux.shared -> OBJ2
OBJ2   ptr -> "content"
            len -> 7
            aux.capa -> 7

Question: 1) Why do this at the time a string object is created?
                 2) Do Arrays do the same thing?
                 3) Other Built-in Types do something similar
                    (they don't seem to use ELTS_SHARED anyway)

-- 
GodFather -- 667 Neighbor of the Beast


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic