From: khaines@... Date: 2008-04-25T02:04:54+09:00 Subject: Re: Pointer concept in Ruby ? --574647984-2007579202-1209056694=:5646 Content-Type: MULTIPART/MIXED; BOUNDARY="574647984-2007579202-1209056694=:5646" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --574647984-2007579202-1209056694=:5646 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 25 Apr 2008, [UTF-8] I=C3=B1aki Baz Castillo wrote: > Sure, but I already kwen it, note that I was answering to Mikael that sai= d: > >> If you however call a self-modifying method on a1 while it's pointing at= the array string, it'll also >> change in the array, as it's still pointing at the same object. > > > But thanks for the explanation :) If you already knew it, what is the confusion? You misunderstood what he= =20 said. He said: "If you however call a self-modifying method on a1 while it's pointing at= =20 the array string, it'll also change in the array, as it's still pointing at= the same object." Note the "self-modifying" words there. In your example, you weren't changing what a1 pointed to; you were not=20 changing anything about the object itself. irb(main):001:0> a =3D ['0','1','2','3'] =3D> ["0", "1", "2", "3"] irb(main):002:0> a[1] =3D> "1" irb(main):003:0> a1 =3D a[1] =3D> "1" irb(main):004:0> a1 << 'abc' =3D> "1abc" irb(main):005:0> a[1] =3D> "1abc" This is what he meant by "self-modifying" methods. Methods that change=20 something about the object itself. Kirk Haines --574647984-2007579202-1209056694=:5646-- --574647984-2007579202-1209056694=:5646--