> It's definitely a potential issue. You can protect against it by
> returning a dup of the array:
> 
>    class C
>      attr_writer :a
>      def a
>        @a.dup
>      end
>    end

I remember in C++, when an object is returned, it is always the dup...

while in Java, when an object is returned, it is always just the pointer 
to the object, so it is the same object... and change to it will affect 
the original.

and if it is in C++, if an array is returned, it is also just the 
pointer to the array... so the data is not protected from change.

-- 
Posted via http://www.ruby-forum.com/.