--574647984-2007579202-1209056694646
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-1209056694646
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Fri, 25 Apr 2008, [UTF-8] IƱaki Baz Castillo wrote:

> Sure, but I already kwen it, note that I was answering to Mikael that said:
>
>> If you however call a self-modifying method on a1 while it's pointing athe 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 
said.  He said:

"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 athe same object."

Note the "self-modifying" words there.

In your example, you weren't changing what a1 pointed to; you were not 
changing anything about the object itself.

irb(main):001:0> a = ['0','1','2','3']
=> ["0", "1", "2", "3"]
irb(main):002:0> a[1]
=> "1"
irb(main):003:0> a1 = a[1]
=> "1"
irb(main):004:0> a1 << 'abc'
=> "1abc"
irb(main):005:0> a[1]
=> "1abc"

This is what he meant by "self-modifying" methods.  Methods that change 
something about the object itself.


Kirk Haines

--574647984-2007579202-1209056694646--
--574647984-2007579202-1209056694646--