From: Robert Klemme Date: 2009-02-15T08:58:29+09:00 Subject: Re: Frozen OpenStruct allows modification On 15.02.2009 00:18, Stefan Lang wrote: > 2009/2/14 bhz : >> Why does OpenStruct allow modification after it has been frozen? Output is >> 20 in both ruby 1.8.6 and 1.9: >> >> require 'ostruct' >> >> a = OpenStruct.new() >> a.foo = 10 >> a.freeze() >> a.foo = 20 >> puts a.foo > > Because the OpenStruct instance is never modified here, > only the internal hash it uses to store attribute values. > The internal hash is not frozen, only the OpenStruct instance > itself. That could still be considered a bug and IMHO it is. Kind regards robert