From: Paul Brannan Date: 2002-02-23T05:07:28+09:00 Subject: Re: dispatching and class references On Sat, Feb 23, 2002 at 04:52:14AM +0900, Mark Probert wrote: > Now I -am- confused! :-) > > I have added 'freeze' to the Sym.new() call, and ruby says the object > is frozen. However, I can still modify the returned object val. The > same happens if I .dup() the dispatch method. It looks like you've frozen your container but not the objects inside. [pbrannan@zaphod src]$ irb irb(main):001:0> a = "foo" "foo" irb(main):002:0> b = "bar" "bar" irb(main):003:0> arr = [a, b].freeze ["foo", "bar"] irb(main):004:0> arr[0] = 42 TypeError: can't modify frozen array from (irb):4:in `[]=' from (irb):4 irb(main):005:0> a[0] = "b" "b" irb(main):006:0> p arr ["boo", "bar"] nil Paul