From: Douglas Livingstone Date: 2005-04-05T04:44:26+09:00 Subject: Re: doubly linked list in Ruby? On Apr 4, 2005 8:39 PM, Randy Kramer wrote: > > But (just asking), what about performance? Is an entire new array created, or > is the new stuff (only) put in a newly allocated piece of memory and a > pointer/reference/whatever inserted into (maybe a linked list which > implements) the array? > irb(main):001:0> a = [1,2,3] => [1, 2, 3] irb(main):002:0> b = a => [1, 2, 3] irb(main):003:0> b[2,0] = 4 => 4 irb(main):004:0> a => [1, 2, 4, 3] irb(main):005:0> b => [1, 2, 4, 3] irb(main):006:0> a == b => true [] is sugar for Array.new, they are objects like any other. hth, Douglas