On 06 Dec 2004, at 07:32, itsme213 wrote: > > "Austin Ziegler" <halostatue / gmail.com> wrote in message >> a = Struct.new("Effable", :a, :b).new >> a.a = "abcdef" >> a.b = %w(a b c d e f) >> a.freeze >> a.a = "ghijkl" # raises error >> a.a.gsub!(/a/, 'z') # no error >> a.b[0] = 'z' # no error >> >> Freeze isn't necessarily recursive. > > Correct. All instance variables of the object are frozen, not the > objects > they refer to. No, the instance variables are not frozen, the instance 'a' of Effable is. #a= modifies a, which is disallowed because a is frozen. You cannot freeze variables, just objects. a = "foo" a.freeze a = "bar"