Ronald E Jeffries
12/15/2005 11:17:00 PM
On Thu, 15 Dec 2005 14:50:59 +0900, "Daniel Sheppard" <daniels@pronto.com.au>
wrote:
>I might be wrong - but I'm pretty sure that substrings in ruby are
>created with copy-on-write. That is, when you take a substring, a new
>block of memory isn't allocated to the new String, it references the
>same block of memory as the original string - the allocation of a new
>block of memory only occurs when one of the strings is modified.
I asked about this a week or two ago, as part of my Extended Set Theory thing,
and the impression I got from the answers then was that sub /arrays/ are copy on
write but that sub /strings/ were not.
I wonder how one might confirm this, other than by asking matz or reading the
compiler and libraries ...
--
Ron Jeffries
www.XProgramming.com
I'm giving the best advice I have. You get to decide if it's true for you.